Advertisement
JkSoftware

Day 3 - Logical Operators

Nov 5th, 2021
960
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. height = int(input("What is your height in cm? "))
  2. bill = 0
  3. if height >= 120:
  4.     print("You may ride the rollercoaster")
  5.     age = int(input("What is your age?"))
  6.     if age < 12:
  7.         print("Child tickets are $5")
  8.         bill += 5
  9.     elif age <= 18:
  10.         print("Youth tickets are $7")
  11.         bill += 7
  12.     elif age >= 45 and age <= 55: # and logical operator
  13.         print("You are in midlife crises, maybe this free ride will help")
  14.     else:
  15.         print("Adult tickets are $12")
  16.         bill += 12
  17.    
  18.  
  19.     wants_photo = input("Would you like a photo taken? Y or N")
  20.     if wants_photo == "Y":
  21.         bill += 3
  22.  
  23.     print(f"Your total bill is ${bill}")
  24.    
  25.  
  26. else:
  27.     print("Sorry, you have to grow taller before you can ride")
  28.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement