DiYane

Excursion Calculator

Jun 10th, 2023
568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. def calculate_price(num_people, season):
  2.     if season == "spring":
  3.         price_per_person = 50
  4.     elif season == "summer":
  5.         price_per_person = 45
  6.     elif season == "autumn":
  7.         price_per_person = 49.50
  8.     elif season == "winter":
  9.         price_per_person = 85
  10.    
  11.     total_price = price_per_person * num_people
  12.    
  13.     if season == "summer":
  14.         total_price *= 0.85  # 15% отстъпка
  15.     elif season == "winter":
  16.         total_price *= 1.08  # 8% оскъпяване
  17.    
  18.     return "{:.2f} leva.".format(total_price)
  19.  
  20.  
  21. num_people = int(input())
  22. season = input()
  23.  
  24. price = calculate_price(num_people, season)
  25. print(price)
  26.  
Advertisement
Add Comment
Please, Sign In to add comment