BbJLeB

06. Fruit Shop

May 7th, 2019
210
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().lower()
  2. day = input().lower()
  3. quantity = float(input())
  4. price = 0;
  5.  
  6. if day == "monday" or day == "tuesday" or day == "wednesday" or day == "thursday" or day == "friday":
  7.     if fruit == "banana":
  8.         price = quantity * 2.50
  9.     elif fruit == "apple":
  10.         price = quantity * 1.20
  11.     elif fruit == "orange":
  12.         price = quantity * 0.85
  13.     elif fruit == "grapefruit":
  14.         price = quantity * 1.45
  15.     elif fruit == "kiwi":
  16.         price = quantity * 2.70
  17.     elif fruit == "pineapple":
  18.         price = quantity * 5.50
  19.     elif fruit == "grapes":
  20.         price = quantity * 3.85
  21. elif day == "saturday" or day == "sunday":
  22.     if fruit == "banana":
  23.         price = quantity * 2.70
  24.     elif fruit == "apple":
  25.         price = quantity * 1.25
  26.     elif fruit == "orange":
  27.         price = quantity * 0.90
  28.     elif fruit == "grapefruit":
  29.         price = quantity * 1.60
  30.     elif fruit == "kiwi":
  31.         price = quantity * 3.00
  32.     elif fruit == "pineapple":
  33.         price = quantity * 5.60
  34.     elif fruit == "grapes":
  35.         price = quantity * 4.20
  36.  
  37. if price > 0:
  38.     print(f"{price:.2f}")
  39. else:
  40.     print("error")
Advertisement
Add Comment
Please, Sign In to add comment