Say if you had a number input 8 in python and you wanted to generate a list of consecutive numbers up to 8 like
8
[0, 1, 2, 3, 4, 5,
Using Python's built in range function:
Python 2
input = 8 output = range(input + 1) print output [0, 1, 2, 3, 4, 5, 6, 7, 8]
Python 3
input = 8 output = list(range(input + 1)) print(output) [0, 1, 2, 3, 4, 5, 6, 7, 8]