代码拉取完成,页面将自动刷新
#列表 list
l1 = list ("zhaoxiaobo")
print(type(l1),l1)
l7 = [1,2,3,4,5,6]
print(99 in l7)
print(6 in l7)
#运算
l5 = [1,2,3]
l6 = ["python","go"]
print(l5 + l6)
print(l5 * 3)
#常用方法
l11 = [1,2,3]
result = l11.pop()
print("l11",result,l11)
l12 = [1,2,3]
result =l12.pop(1)
print("l12",result,l12)
l13 =[1,2,"老六",3,4,"老六",5]
l13.remove("老六")
print(l13)
l14 = [2,23,14,34,17]
l14.sort()
print(l14)
l15 = [2,4,3,6,98]
l15.sort(reverse=True)
print(l15)
l16 = ["python","r","go"]
l16.sort(key=len)
print(l16)
l17 = [2,23,14,34,17,19,10]
l17 .reverse()
print(l17)
l18 =[
[1,2,3],
[4,5,6],
[7,8,9]
]
print(l18[0][0])
l18.append([100,102,103])
print(l18)
l18[0].append(99)
print(l18)
l19 = []
for i in range(10):
if i %2 == 0:
l19.append(i)
print(l19)
l20 = []
for i in range(0,10,2):
l20.append(i)
print(l20)
l21 = [i for i in range(10) if i % 2 == 0]
print(l21)
l22 = [i for i in range(0,10,2)]
print(l22)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。