三, 练习 python索引 (list和tuple)

时间:2023-03-09 00:55:38
三, 练习     python索引   (list和tuple)

(1)

练习

请用索引取出下面list的指定元素:

1,

 # -*- coding: utf-8 -*-
L = [
['Apple', 'Google', 'Microsoft'],
['Java', 'Python', 'Ruby', 'PHP'],
['Adam', 'Bart', 'Lisa']
]

2,

三, 练习     python索引   (list和tuple)

答案:1,

L = [
['Apple', 'Google', 'Microsoft'],
['Java', 'Python', 'Ruby', 'PHP'],
['Adam', 'Bart', 'Lisa']
]

print("L=",L[0][2])
print("L=",L[1][2])
print("L=",L[2][2])

三, 练习     python索引   (list和tuple)

三, 练习     python索引   (list和tuple)