Sichanov

fruit

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