熊咪

python的循环语句等
names = ['Michael', 'Bob', 'Tracy']
for name in names:
    print name




sum = 0
for x in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
    sum = sum + x
print sum




sum = 0
n = 99
while n > 0:
    sum = sum + n
    n = n - 2
print sum




以上这三种就已经够用了

posted on 2015-05-14 11:04  熊咪  阅读(108)  评论(0编辑  收藏  举报