Lists inside lists | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

Lists inside lists

Why is it: print([2][2]) instead of: print([2[2]]) ?

1st Dec 2016, 8:01 AM
Kai B.
Kai B. - avatar
1 Answer
If you want to print list inside of list. Then use correct syntax. Your code is with wrong syntax. put comma between two list like print([2,[2]]) and in first code, you print two list without separation. Here also you have to use comma like print([2],[2])
1st Dec 2016, 8:30 AM
Aditya kumar pandey
Aditya kumar pandey - avatar