Sichanov

fruit

Sep 25th, 2021
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. fruit = str(input())
  2. day = str(input())
  3. quantity = float(input())
  4. days = [['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'], ['Saturday', 'Sunday']]
  5. total_price = 0
  6. prices = {"banana": [2.5, 2.7], 'apple': [1.2, 1.25], 'kiwi': [2.7, 3], 'orange': [0.85, 0.9],
  7.           'grapefruit': [1.45, 1.6], 'pineapple': [5.5, 5.6],
  8.           'grapes': [3.85, 4.2]}
  9.  
  10. if fruit in prices:
  11.     if day in days[0]:
  12.         total_price = quantity * prices[fruit][0]
  13.     elif day in days[1]:
  14.         total_price = quantity * prices[fruit][1]
  15.  
  16. if total_price == 0:
  17.     print('error')
  18. else:
  19.     print(f'{total_price:.2f}')
  20.  
Advertisement
Add Comment
Please, Sign In to add comment