Sichanov

fruit

May 27th, 2021
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | None | 0 0
  1. fruit = input()
  2. day_of_week = input()
  3. quantity = float(input())
  4. price = 0
  5.  
  6. is_working_day = day_of_week == 'Monday' or \
  7.                  day_of_week == "Tuesday" or \
  8.                  day_of_week == "Wednesday" or \
  9.                  day_of_week == "Thursday" or \
  10.                  day_of_week == "Friday"
  11.  
  12. is_weekend = day_of_week == "Saturday" or \
  13.              day_of_week == "Sunday"
  14.  
  15. if is_working_day:
  16.     if fruit == "banana":
  17.         price = 2.5
  18.     elif fruit == "apple":
  19.         price = 1.2
  20.     elif fruit == "orange":
  21.         price = 0.85
  22.     elif fruit == "grapefruit":
  23.         price = 1.45
  24.     elif fruit == "kiwi":
  25.         price = 2.7
  26.     elif fruit == "pineapple":
  27.         price = 5.5
  28.     elif fruit == "grapes":
  29.         price = 3.85
  30. elif is_weekend:
  31.     if fruit == "banana":
  32.         price = 2.7
  33.     elif fruit == "apple":
  34.         price = 1.25
  35.     elif fruit == "orange":
  36.         price = 0.9
  37.     elif fruit == "grapefruit":
  38.         price = 1.6
  39.     elif fruit == "kiwi":
  40.         price = 3
  41.     elif fruit == "pineapple":
  42.         price = 5.6
  43.     elif fruit == "grapes":
  44.         price = 4.2
  45. if price == 0:
  46.     print('error')
  47. else:
  48.     total_price = price * quantity
  49.     print(f"{total_price:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment