python中的循环
python中有两种循环
1.for i in name
names=['li','wang','zhou'] #注释 for name in names: print(name)
sum = 0 for x in range(101): sum = sum + x print(sum)
2.while
sum = 0 n = 99 while n > 0: sum = sum + n n = n - 2 print(sum)
python中有两种循环
1.for i in name
names=['li','wang','zhou'] #注释 for name in names: print(name)
sum = 0 for x in range(101): sum = sum + x print(sum)
2.while
sum = 0 n = 99 while n > 0: sum = sum + n n = n - 2 print(sum)