The syntax of the python process control

# 1, while loop 2 output. 3. 4. 5. 6 1. 9 10. 8 
# COUNT = 0 
# while COUNT <10: 
#      COUNT = 1 + 
#      IF COUNT ==. 7: 
#          Continue 
#      Print (COUNT) 


# 2, a seek All numbers -100 and 
# SUM = 0 
# for I in Range (. 1, 101): 
#      SUM = I + 
#      Print (SUM) 


# . 3, the output of all the odd 1-100 
# for I in Range (. 1 , 101, 2): 
#      Print (I) 


# . 4, the output of all the even-numbered 1-100 
# for I in Range (2, 101, 2): 
#          Print (I) 


#5, find all the numbers 1-2 + 3-4 + 5 ... 99 and 
# SUM = 0 
# for I in Range (100): 
#      IF I = 0% 2:! 
#          SUM = I + 
#      the else : 
#          SUM - I = 
# Print (F "1-2 + 3-4 + 99. 5 + ... and the number of all: SUM {}") 
# 
# 
# #. 6, guessing game Age 
# Age = '18 is' 
# True = Tag 
# COUNT = 0 
# the while Tag: 
#      guess_age the iNPUT = ( 'Please enter ages:') Strip (). 
#      # guess_age = int (guess_age) 
#      IF guess_age == Age: 
#          Print ( 'guessed' ) 
#          BREAK
#      The else: 
#          Print ( 'the wrong') 
#          COUNT =. 1 + 
#      IF COUNT == 0. 3%: 
#          answer = INPUT ( 'Enter Y to continue or to guess y, exit or enter N n:'). Strip () 
#          IF answer Not in [ 'the Y', 'Y']: 
#              Tag = False 



# . 7, use of the knowledge, the print pattern 
#      * 
#     * * * 
#    ***** 
#   **** *** 
# *************************************** 

for I in Range (. 1,. 6 ):
     Print ( '  ' * (. 5-I) + ' * ' * (I-2 *. 1) + ' '*(5-i))

 

Guess you like

Origin www.cnblogs.com/Cheryl-D/p/11794761.html