kostovhg

fruit_shop_2

Mar 20th, 2021 (edited)
132
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fruit = input()
  2. day = input()
  3. amount = float(input())
  4. valid = False
  5. if day == "Monday" or day == "Tuesday" or day == "Wednesday" or day == "Thursday" or day == "Friday" or\
  6.         day == "Saturday" or day == "Sunday":
  7.     valid = True
  8.     weekend = day[0] == "S"
  9.    
  10. if valid:
  11.     if fruit == "banana":
  12.         price = 2.7 if weekend else 2.5
  13.     elif fruit == "apple":
  14.         price = 1.25 if weekend else 1.2
  15.     elif fruit == "orange":
  16.         price = 0.90 if weekend else 0.85
  17.     elif fruit == "grapefruit":
  18.         price = 1.6 if weekend else 1.45
  19.     elif fruit == "kiwi":
  20.         price = 3.0 if weekend else 2.7
  21.     elif fruit == "pineapple":
  22.         price = 5.6 if weekend else 5.5
  23.     elif fruit == "grapes":
  24.         price = 4.2 if weekend else 3.85
  25.     else:
  26.         valid = False
  27. print(f"{amount * price:.2f}" if valid else "error")
  28.  
RAW Paste Data