python- condition statement Exercise

1. The while loop input 1234568910

# While loop 2 output. 3. 4. 5. 6. 1. 9 10. 8 
I =. 1 while I <= 10 :
     IF I =. 7! :
        Print (I)
     the else :
         Print ( ' ' ) 
    I = I +. 1
 Print ( ' - ---- --end ' )
 

 

or

i=1
while i<11:
       if i==7:
           pass
       else:
           print(i)
       i=i+1
print('----end----')

 

 

2. All numbers 1-100 and seek

# Find all the numbers 1-100 and 
I. 1 = 
S = 0
 the while I <101 : 
       S = S + I 
       I = I +. 1
 Print ( ' S =. 1 + 2 + = 100. 3 + ... + ' , S )

 

 

Guess you like

Origin www.cnblogs.com/lijinping716/p/11069730.html