How can I make many empty lists without manually typing
list1=[] , list2=[], list3=[]
Is there a for loop that will make me 'n' number of such empty lists?
How can I make many empty lists without manually typing
list1=[] , list2=[], list3=[]
Is there a for loop that will make me 'n' number of such empty lists?
Sorry that I am two years late, but maybe I can still help some other people.
The code below will dynamically 'create' itself. For every iteration, the following command will issued:
Where number is the value of i in the loop.
The result of this particular piece of code is three variables: list1, list2 and list3 being created and each assigned an empty list.
You can generalize this to make practically anything you want. Do note that you cannot put this into a function as far as I know, because of how variables and global variables work.
I hope I helped!