Bonus:
Resuelvan el caso donde inicio = -5, fin = -10, salto = -1
Código Python:
Ver originaldef generateNumber(inicio, final, salto):
return range(inicio, final + (salto > 0), salto)
if __name__ == '__main__':
assert generateNumber(2,10,2) == [2, 4, 6, 8, 10]
assert generateNumber(20,0,-3) == [20, 17, 14, 11, 8, 5, 2]
assert generateNumber(15, 6, -2) == [15, 13, 11, 9, 7]
assert generateNumber(-10, -5, 1) == [-10, -9, -8, -7, -6, -5]
assert generateNumber(-5, -10, -1) == [-5, -6, -7, -8, -9, -10]