- 3

Can anyone plz explain me what the hell is the code about

https://code.sololearn.com/cma60NBYga4X/?ref=app

25th Aug 2020, 10:51 AM
zeeshan
zeeshan - avatar
4 ответов
+ 3
List can store numbers, strings, tuple, set, dictionary...etc
25th Aug 2020, 11:01 AM
Ajith
Ajith - avatar
+ 1
It's workin'
25th Aug 2020, 10:54 AM
Utkarsh Gupta
Utkarsh Gupta - avatar
+ 1
You are just trying to access elements of a list in python through this code.
25th Aug 2020, 11:01 AM
Arsenic
Arsenic - avatar
+ 1
The first print function is printing the value in the array 'things' which is indexed 1 (means second item) The second print function is printing the value in the array 'things' which is indexed 2 (means third item). As in this array second item is one more array, so it will print the whole array present inside the another array. The third print function is printing the value in the array 'things' which is indexed 2 (means third item) but it is not only printing the whole third item which is array but also the third item inside the array. That's why two indexes are given things[2][2] Try this code for simple explanation: number = 3 things = ["string", [1, 2, number]] for i in range(len(things)): for j in range(len(things[i])): print("things[",i,"][",j,"] = ",things[i][j])
25th Aug 2020, 11:01 AM
Aman Kumar
Aman Kumar - avatar