Sichanov

fruit

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