r/learnpython • u/sillycups • Aug 27 '18
Create an empty list
Good monday everyone!
I just started university and is learning python. I have no experience with the language whatsoever so i was hoping on getting some help here :)
We got an assignment to get used to some of the basic functions. The task is:
Create a program which starts with an empty list and ends up with a list
containing the numbers 1-10.000. This should not be done manually like
mylist=[1,2,...,10.000]. Hint use a for-loop and append.
Been stuck at this for hours now.
appreciate all answers :)
0
Upvotes
0
u/noodlesource Aug 27 '18
You can create an empty list:
You can then use a for loop to iterate over a block of code, appending a number to your list each iteration. I'd suggest taking a look at how "for" loops work if you have never coded before.