组合数据类型综合练习:1.组合数据类型练习

#字符串
s = 'Hello'
for i in s:
    print(i)
  
# 列表
ls = ['p', 'y', 'Char', 'm']
for i in ls:
    print(i)
  
# 元组
tup = tuple('tuple')
for i in tup:
    print(i)
  
# 字典
names = ['Help', 'Make', 'Charm', 'Better']
score = [98, 89, 78, 80]
dic = dict(zip(names, score))
print(dic)
for i in dic:
    print(i)
print(dic.keys())
  
# 集合
s = set(dic.keys())
print(s)
for i in s:
    print(i)

  

posted @ 2018-03-22 21:16  235郑杰升  阅读(126)  评论(0编辑  收藏  举报