列表、元组、字典、集合的定义与操作

l = ['leo','yao','y']
l.append('yao')
l.pop()
print(1)

t = ('leo','yao','y')

scores = [99,66,89]

d = {'leo':99,'yao':66,'y':89}
d['yao'] = 99
d['Rose'] = 66
d.pop('yao')

print(d)

sl = {'leo','yao','y'}
s2 = {'leo',2,3}
sl.add(12)
s2.remove(3)
print(sl,s2)

dl = dict(zip(l,scores))
print(1)
print(scores)
print(dl)

posted @ 2018-06-06 21:24  Doshelly  阅读(99)  评论(0)    收藏  举报