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

 

1、字符串

str="hellopython"
for i in str:
    print(i)
 

2、列表

ls=['h''e''l''l''o''p''y''t''h''o''n']
for i in ls:
    print(i)

3、元组

t=('hello','python',2018)
for i in t:
    print(i)

4、字典

d={'p':0,'y':1,'t':2,'h':3,'o':4,'n':5}
for i in d:
    print(i)

5、集合

st =set('h''e''l''l''o''p''y''t''h''o''n')
for i in st:
    print(i)
原文地址:https://www.cnblogs.com/piglet00/p/8626055.html