' Basic use if condition: code that satisfies the conditional execution: ' ' ' ' ' ' ' # age = Input ' ("* * Input Age:") # The result from input by default is STR,STR Format cannot be performed by < # so you have to convert the type # ' # ' # if age < 30:# print ("Can still toss for a few years") # else:# print ("Old old") "multi-branch to determine if condition: code elif condition that satisfies the condition: satisfies the bar Code elif Condition: The code that satisfies the conditional execution "' # age = Int (input (" Please input: ")] # if age < 18:# print (" read well ... ") # elif < age <= 20:# print ("Just go on, keep trying") # Elif < age <= 30:# print ("Plus, Young") # Elif < age <= 35 : # Print ("The Age of Embarrassment ...") # elif Age > 35:# Print ("The retired ...") # "to write a Guess Age game # ' # ' # info = ' # guess the game # guess the size Oh #" # Ye_ Age = 18## and true:# print (info) # age = Int (input ("Please input him Age:") # if > 50:# print ("Too big, try smaller") # elif < age <= 50:# print ("Still a little big but it's pretty quick to guess") # elif <= age <= 30:# print ("Fast") # Elif Age < 18:# print ("Too small ") # elif Age = = 18:# Print (" Congratulations, guess right!!! ") ") ' Write a scoring system a 90-100b 80-89c 70-79d 0-69 ' ' # varual = Int (input (" Please input: ")) # if varual > 100:# print (" Inverse day, out of the 10 0, you have to%s , Little bunny: "% (varual)) # elif varual >= 90:# print (" Good score, A-level ") # elif varual >= 80:# print (" Nice, nice, and top-notch, B-level ") # Elif V Arual >= 70:# Print ("No effort on the Red Line, C-level") # elif Varual < 70:# print ("D-level, retarded, little bunny ...")
Python basic Process Control-if. else