# Chapter 3 # Booleans page 66 vipStatus = True # boolean orderStatus = "True" # string shipStatus = False # boolean # relational operators page 67 # Equals Symbol # = assign a value arithmetic operator assigns value # == in equality to relational operator tests value # === strictly in equality to tests type and value age = 21 if (age < 21): # relation operator age < 21 print("You can not drink") # True else: print("You can drink") # logical operator page 69 # variable name HAS TO BE on both sides of the operator # (age >= 18 and age < 21) # and or not state = "FL" # (age > 16 and state = "FL") # page 73 if if (age >= 18 and age < 21): print("You can vote but you can not drink") elif (age >= 21 and age < 65): print("You can vote and drink, but not retire") elif (age >= 65): print("You can vote, drink and retire") else: print("You are less than 18 years old. You can not vote, drink or retire") # Page 71 lower() upper() title() # data cleanup or cleansing firstname = input("Enter your first name: ").title().rstrip() middleinitial = input("Enter your middle initial: ").upper() lastname = input("Enter your last name: ").title() # Mary jones-smith.title() Jones-Smith print("Contact first name: " + firstname) print("Contact middle initial: " + middleinitial) print("Contact last name: " + lastname) # Nested statements if statement page 77 if (age >= 18 and age < 21): # vote and drink in FL if state == "FL": print("You can vote and drink") else: print("You can vote but not drink") elif (age >= 21 and age < 65): print("You can vote and drink, but not retire") elif (age >= 65): print("You can vote, drink and retire") else: print("You are less than 18 years old. You can not vote, drink or retire")