Advertisement
PowerCell46

Gladiator's expenses Python

Dec 24th, 2022
1,138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. lost_fights_count = int(input())
  2.  
  3. helmet_price = float(input())
  4. sword_price = float(input())
  5. shield_price = float(input())
  6. armor_price = float(input())
  7.  
  8. current_lost_battle = 0
  9.  
  10. helmet_counter = 0
  11. sword_counter = 0
  12. shield_counter = 0
  13. armor_counter = 0
  14.  
  15. while True:
  16.     current_lost_battle += 1
  17.     if current_lost_battle == lost_fights_count + 1:
  18.         break
  19.     if current_lost_battle % 2 == 0:
  20.         helmet_counter += 1
  21.     if current_lost_battle % 3 == 0:
  22.         sword_counter += 1
  23.     if current_lost_battle % 2 == 0 and current_lost_battle % 3 == 0:
  24.         shield_counter += 1
  25.         if shield_counter % 2 == 0:
  26.             armor_counter += 1
  27.  
  28. spended_money = helmet_price * helmet_counter + sword_price * sword_counter + shield_price * shield_counter + armor_price * armor_counter
  29. print(f'Gladiator expenses: {spended_money:.2f} aureus')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement