r/learnpython • • 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

11 comments sorted by

View all comments

5

u/[deleted] Aug 27 '18

Also, Python Crash Course has an excellent chapter on Lists and associated methods. Plus, and apologies if this sounds cryptic, but if you know how to create a list with elements, you already know the syntax to create an empty list.

Edit: Grammar

0

u/sillycups Aug 27 '18

I will be sure to check it out! :)