python 3.9
t=['physics','maths',2000,10,'computer']
print(t[0:1])
输出结果:
[‘physics’]
print(t[0:2])
输出结果:
[‘physics’,‘maths’]
print(t[4])
输出结果为:
[‘computer’]
print(t[1:3])
结果为:
[‘maths’,2000]
python 3.9
t=['physics','maths',2000,10,'computer']
print(t[0:1])
输出结果:
[‘physics’]
print(t[0:2])
输出结果:
[‘physics’,‘maths’]
print(t[4])
输出结果为:
[‘computer’]
print(t[1:3])
结果为:
[‘maths’,2000]