Advertisement
exDotaPro

2019_6_july_3_coffee_machine

Feb 1st, 2020
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. drink_type = input()
  2. sugar = input()
  3. drinks_count = int(input())
  4.  
  5. drink_price = 0
  6. final_price = 0
  7. sugar_discount = False
  8. espresso_discount = False
  9.  
  10. if sugar == 'Without':
  11.  
  12.     if drinks_count >= 5:
  13.         espresso_discount = True
  14.  
  15.     if sugar == 'Extra':
  16.         drink_price = 1.20
  17.     elif sugar == 'Normal':
  18.         drink_price = 1.00
  19.     elif sugar == 'Without':
  20.         drink_price = 0.90
  21.         sugar_discount = True
  22.  
  23. elif drink_type == 'Cappuccino':
  24.     if sugar == 'Extra':
  25.         drink_price = 1.60
  26.     elif sugar == 'Normal':
  27.         drink_price = 1.20
  28.     elif sugar == 'Without':
  29.         drink_price = 1.00
  30.         sugar_discount = True
  31.  
  32. elif drink_type == 'Tea':
  33.     if sugar == 'Extra':
  34.         drink_price = 0.70
  35.     elif sugar == 'Normal':
  36.         drink_price = 0.60
  37.     elif sugar == 'Without':
  38.         drink_price = 0.50
  39.         sugar_discount = True
  40.  
  41. total_price = drink_price * drinks_count
  42. final_price = total_price
  43.  
  44. if sugar_discount:
  45.     sugar_discount = total_price * 0.35
  46.     final_price = total_price - sugar_discount
  47. if espresso_discount:
  48.     espresso_discount = final_price * 0.25
  49.     final_price -= espresso_discount
  50.  
  51. if final_price >= 15:
  52.     final_price *= 0.8
  53.  
  54. print(f'You bought {drinks_count} cups of {drink_type} for {final_price:.2f} lv.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement