python循环while&for

# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""
def ln():
    print("-"*80)
ln()
print(list(range(3,11,2)))

#while using method
suma=0
j=1
while j<101:
     suma +=j
     j +=1
 
print(j,suma)
ln()
print(sum(range(1,101)))
ln()
#for using method
for i in range(3,11,2):
    print(i,end="")
print("\n")   
s = "Python"   
for c in s:
    print(c,end ="")
print("\n")
for i in range(len(s)):
    print(s[i],end ="")
print("\n")
ln()
x = iter(range(1,11,3))
for i in x:
    print(i)
ln()
print(type(x))
ln()
#which one can not repeat 5 times
a = 0
while a < 5:
    a += 1
    print(a,end="")
print()   
for a in range(5):
    print(a,end="")
print()    
for a in range(1, 5, 1):
    print(a,end="")
print()
iters = [1, 2, 3, 4, 5]
for a in iters:
    print(a,end="")
print("\n")

i,j,k = 0,0,0
count=0
s =[]
for i in range(21):
    for j in range(51):
        t=100-5*i-2*j
        if t>0:
               s.append(t)
               count +=1
print("Money compound count=",s)
print(len(s))
print(count)