1

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

2 Answers 2

13
possible = range(1, 101)

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

Sign up to request clarification or add additional context in comments.

2 Comments

range doesn't return list in python3, so be aware.
it is, of course, trivial to create a list with list(range(1,101)) in python3.x
0

Something like this?

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.