tags:

views:

53

answers:

2

Here is what I have so far. Is there anyway, I can auto increment the list while it is being built? So instead of having all ones, I'd have 1,2,3,4....

possible = []
possible = [1] * 100
print possible

Thanks, Noah

+10  A: 
possible = range(1, 101)

Note that the end point (101 in this case) is not part of the resulting list.

Thomas
range doesn't return list in python3, so be aware.
Odomontois
it is, of course, trivial to create a list with `list(range(1,101))` in python3.x
Wayne Werner
A: 

Something like this?

start=1
count= 100
possible = [num for num in range(start,start+count)]
print possible
Tony Veijalainen