"Python Basics" Process Control-if. Else

Source: Internet
Author: User

' 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.