Advertisement
anton_d

09.fuel_tank_pt2

Jan 16th, 2022 (edited)
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. fuel_type = input().lower()
  2. fuel_amount = float(input())
  3. discount_card = input().lower()
  4.  
  5. fuel_price = 0
  6.  
  7. if fuel_type == 'gas':
  8.     fuel_price = fuel_amount * 0.93
  9. elif fuel_type == 'gasoline':
  10.     fuel_price = fuel_amount * 2.22
  11. elif fuel_type == 'diesel':
  12.     fuel_price = fuel_amount * 2.33
  13. else:
  14.     print('Invalid fuel!')
  15.  
  16. if discount_card == 'yes':
  17.     if fuel_type == 'gas':
  18.         fuel_price -= 0.08 * fuel_amount
  19.     elif fuel_type == 'gasoline':
  20.         fuel_price -= 0.18 * fuel_amount
  21.     elif fuel_type == 'diesel':
  22.         fuel_price -= 0.12 * fuel_amount
  23.  
  24. if 20 <= fuel_amount <= 25:
  25.     fuel_price *= 0.92
  26. elif fuel_amount > 25:
  27.     fuel_price *= 0.90
  28.  
  29.  
  30. print(f'{fuel_price:.2f} lv.')
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement