组合数据类型练习,综合练习

'''字符串'''
str = "This is a string"
for i in str:
    print(i)

'''列表'''
list = ['a','b','c','hasee']
for i in list:
    print(i)

'''元组'''
tup = ('a','b',123,'hasee')
for i in tup:
    print(i)

'''字典'''
dict = {'jakey':1,'imp':2}
for k,v in dict.items():
    print(k,v)

'''集合'''
se = set('abc')
for i in se:
    print(i)

  

字符串无序;
列表有序可修改;
元组有序不可修改;
字典无序可修改;
集合无序不可修改。
posted @ 2018-03-22 12:44  088陈志鸿  阅读(108)  评论(0编辑  收藏  举报