python - 基础算法题7 - 使用while和for循环分别打印字符串s=’asdfer’中每个元素。

s = 'fkld'
for i in s:
    print(i)
index = 0
while 1:
    print(s[index])
    index += 1
    if index == len(s):
        break    

 

posted @ 2019-07-16 10:18  bigbigbrid  阅读(938)  评论(0编辑  收藏  举报