Advertisement
kostovhg

fruit_shop

Mar 20th, 2021
1,083
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  1. fruit = input()
  2. day = input()
  3. amount = float(input())
  4. valid = False
  5. weekend = False
  6. if day == "Monday" or day == "Tuesday" or day == "Wednesday" or day == "Thursday" or day == "Friday":
  7.     valid = True
  8. elif day == "Saturday" or day == "Sunday":
  9.     weekend = True
  10.     valid = True
  11.  
  12. if valid:
  13.     if fruit == "banana":
  14.         price = 2.7 if weekend else 2.5
  15.     elif fruit == "apple":
  16.         price = 1.25 if weekend else 1.2
  17.     elif fruit == "orange":
  18.         price = 0.90 if weekend else 0.85
  19.     elif fruit == "grapefruit":
  20.         price = 1.6 if weekend else 1.45
  21.     elif fruit == "kiwi":
  22.         price = 3.0 if weekend else 2.7
  23.     elif fruit == "pineapple":
  24.         price = 5.6 if weekend else 5.5
  25.     elif fruit == "grapes":
  26.         price = 4.2 if weekend else 3.85
  27.     else:
  28.         valid = False
  29.  
  30. if valid:
  31.     print(f"{amount * price:.2f}")
  32. else:
  33.     print("error")
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement