Branching structure

Sequential structure

""" How many steps do you put the elephant in the refrigerator?" "" print (" 1" - the refrigerator door open) print (" 2 - the elephant the fridge ") print (" 3 - the door close ")Copy the code

Boolean value judgment

Python Everything is an object. All objects have a Boolean value.

Print (bool(False)) print(bool(0)) print(bool(0.0)) print(bool(None)) print(bool('')) print(bool("")) # empty list Print (bool ([])) print (bool (list ())) # empty tuple print (bool (())) print (bool (tuple ())) # empty dictionary print (bool ({})) print (bool (dict ())) # empty collection print (bool (the set ())) print (" -- -- -- -- -- -- -- -- -- -- -- -- the Boolean value of False objects above -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ") Print (" -- -- -- -- -- -- -- -- -- -- -- -- the rest of the objects of the Boolean value is True -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ") print (bool (20))Copy the code

Choose structure

Print (" print ", print) else: print(" print ", print) else: print(" print ", print) else: print(" print ", print) else: print(" print ", print) else: print(" print ", print) else: print(" print ", print) else: print(" print ", print) Print (" score ") score = int(input(" score: ") if score >= 90 and score <= 100: print(" score: ") elif score >= 70 and score < 90: Print (" good ") elif score >= 60 and score < 70: print(" good ") else: Print (" score ") : print(" score ") : print(" score ") : print(" score ") : print(" score ") : print(" score ") : print(" score ") : print(" score ") Print (" score ") elif 70 <= score < 90: print(" score ") else: print(" score ") # Print (if num1 >= num2 else) print(if num1 >= num2 elseCopy the code

Pass statement

The # pass statement does nothing, just a placeholder, used where syntactically the statement is needed is_VIP = input(" Is a member? Y /n") # if is_vip == "y": pass else: passCopy the code