multi_list = [[0 for col in range(col_num)] for row in range(row_num)] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

multi_list = [[0 for col in range(col_num)] for row in range(row_num)]

Y we using 0 before the for loop ?

18th Sep 2021, 3:20 AM
Sai jeevan kumar Sai jeevan kumar
Sai jeevan kumar Sai jeevan kumar - avatar
2 Answers
+ 3
It will fill the multidimensional list with 0's. Run the code and print the list to see.
18th Sep 2021, 3:50 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
BTW your code was incomplete. It was missing definition for <row_num> and <col_num>. Once you complete it though, it's fine.
18th Sep 2021, 3:55 AM
Ipang