I am attempting to create list of lists using for loops in python. My plan is to use two separate loops; one loop to create big lists to put the small lists in, and another loop to create the small lists and append them to the big lists.
This is being used to make a 'battleship' type game where there is a 10x10 grid.
This is the chunk of code I am having difficult with:
for i in range(0,10):
(newlist,(i))=[]
The only task this specific code is meant to complete is to create 10 new lists, each with a different name. For example, the first circulation of the loop would create list0
, the second circulation list1
and so on up to list9
.
Theoretically, I see nothing wrong with this code. It also does work when instead of creating a new list, you are putting a string into the new variable.
Whenever I run the program, I get the error
ValueError: not enough values to unpack (expected 2, got 0)
I have no idea why this occurs, and would be very grateful if anyone here could help me out.