# List in List
# List
friends = ["James", "David", "Anthony", "Larry"]
1
friends = ["James", "David", "Anthony", "Larry"]
print(len(friends)) # 4
print(friends[0]) # James
print(friends[1]) # David
print(friends[2]) # Anthony
print(friends[3]) # Larry
1
2
3
4
5
6
2
3
4
5
6
# Nested List
friends = [
["James",10,"a"],
["David", 9,"b"],
["Anthony", 8],
"Larry"
]
1
2
3
4
5
6
2
3
4
5
6
friends = [
["James",10,"a"],
["David", 9,"b"],
["Anthony", 8],
"Larry"
]
print(len(friends)) # 4
print(friends[0]) # ["James",10,"a"]
print(len(friends[0])) # 3
print(friends[0][0]) # James
print(friends[0][1]) # 10
print(friends[0][2]) # a
print(friends[2]) # ["Anthony", 8]
print(len(friends[2])) # 2
print(friends[3]) # Larry
print(len(friends[3])) # 5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19