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

l = ['Michael','Bob','Tracy']
l.append('Bob')
l.pop()
print(1)

t = ('Michael','Bob','Tracy')

scores = [95,75,85]

d = {'Michael':95,'Bob':75,'Tracy':85}
d['Bob'] = 82
d['Rose'] = 88
d.pop('Bob')

print(d)

sl = {'Michael','Bob','Tracy'}
s2 = {'Michael',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:25  刘海茵  阅读(173)  评论(0编辑  收藏  举报