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
以上这三种就已经够用了
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
以上这三种就已经够用了