dkyoseff

Conditional Statements Advanced - Lab / 11. Fruit Shop

Jul 26th, 2022
1,000
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.15 KB | None | 0 0
  1. fruit = input()
  2. day_of_the_week = input()
  3. quantity = float(input())
  4. price = 0
  5. if day_of_the_week == "Monday" \
  6.         or day_of_the_week == "Tuesday" \
  7.         or day_of_the_week == "Wednesday" \
  8.         or day_of_the_week == "Thursday" \
  9.         or day_of_the_week == "Friday" :
  10.     if fruit == "banana":
  11.         price = 2.50
  12.     elif fruit == "apple":
  13.         price = 1.20
  14.     elif fruit == "orange":
  15.         price = 0.85
  16.     elif fruit == "grapefruit":
  17.         price = 1.45
  18.     elif fruit == "kiwi":
  19.         price = 2.70
  20.     elif fruit == "pineapple":
  21.         price = 5.50
  22.     elif fruit == "grapes":
  23.         price = 3.85
  24. elif day_of_the_week == "Saturday" or day_of_the_week == "Sunday":
  25.     if fruit == "banana":
  26.         price = 2.70
  27.     elif fruit == "apple":
  28.         price = 1.25
  29.     elif fruit == "orange":
  30.         price = 0.90
  31.     elif fruit == "grapefruit":
  32.         price = 1.60
  33.     elif fruit == "kiwi":
  34.         price = 3.00
  35.     elif fruit == "pineapple":
  36.         price = 5.60
  37.     elif fruit == "grapes":
  38.         price = 4.20
  39. if price != 0:
  40.     total_sum = price * quantity
  41.     print(f"{total_sum:.2f}")
  42. else:
  43.     print("error")
Advertisement
Add Comment
Please, Sign In to add comment