#!/user/bin/python# -*- coding:utf-8 -*-lis = [2,3,'k',['qwe',20,['k1',['tt','3','1']],89],'ab','adv']#tt变成大写.lis[3][2][1][0] = 'TT'print(lis)lis[3][2][1][0] = lis[3][2][1][0].upper()print(lis)…
#!/user/bin/python# -*- coding:utf-8 -*-li = ['zs','ls','ww','zl']li.insert(4,'cc')print(li)li.extend('pl')li.extend([1,3,4,5])print(li)print(li)…
#!/user/bin/python# -*- coding:utf-8 -*-username = "zd"password = "123"i = 3while i > 0: zh = input("请输入你的账号:") i -= 1 if zh == username: mm = input("请输入你的密码:") if mm == password: print("验证成功.正在登陆......"…
#!/user/bin/python# -*- coding:utf-8 -*-dic1 = {'age':24,'name':'zd','sex':'boy'}print(dic1)#增dic1['high'] = 175 #没有建就添加dic1['sex'] = 'boy1' #有建就修改print(dic1)dic1.setdefault('weight',232) #有的话不做任何操作m没有的话就添加print(dic1)#删print(dic1.pop('age'))#有返回值按键去删…
#!/user/bin/python# -*- coding:utf-8 -*-tu = ('zs','ls','ww',[1,2,3,4,5,'zxcvb'],'zl')print(tu[3])print(tu[0:4])for i in tu: print(i)tu[3][5] = tu[3][5].upper()print(tu)tu[3].append('fdsfds')print(tu)…
#!/user/bin/python# -*- coding:utf-8 -*-li = [3,5,6546,6,8,324,2,1,34,5,6,7]# li.sort() #正向# print(li)# li.sort(reverse=True) #倒向# print(li)li.reverse()print(li)…
#!/user/bin/python# -*- coding:utf-8 -*-li = ['zs','ls','ww','zl','xx']l = len(li) #总数print(l)num = li.count('ww') #计数几个print(num)print(li.index('zl')) #索引位置#li =…
#!/user/bin/python# -*- coding:utf-8 -*-li = ['zs','ls','ww','zl','xx']li[0] = 'cxvb' #按索引位置print(li)li[0:3] = 'vcxzvcxz' #切片改print(li)…