DiYane

Gladiator expenses

Sep 19th, 2023
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. def calculate_gladiator_expenses(lost_fights, helmet_price, sword_price, shield_price, armor_price):
  2.     helmet_breaks = lost_fights // 2
  3.     sword_breaks = lost_fights // 3
  4.     shield_breaks = lost_fights // 6
  5.     armor_breaks = shield_breaks // 2
  6.  
  7.     total_expenses = (helmet_breaks * helmet_price) + (sword_breaks * sword_price) + \
  8.                      (shield_breaks * shield_price) + (armor_breaks * armor_price)
  9.  
  10.     return total_expenses
  11.  
  12. lost_fights = int(input())
  13. helmet_price = float(input())
  14. sword_price = float(input())
  15. shield_price = float(input())
  16. armor_price = float(input())
  17.  
  18. expenses = calculate_gladiator_expenses(lost_fights, helmet_price, sword_price, shield_price, armor_price)
  19. print(f"Gladiator expenses: {expenses:.2f} aureus")
  20.  
Tags: python
Add Comment
Please, Sign In to add comment