Advertisement
GeorgiLukanov87

01_the_hunting_game_mid_exam_2022

Jun 26th, 2022
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. # 01 The Hunting Game , Mid Exam Fundamentals Python June.2022
  2.  
  3.  
  4. total_days = int(input())
  5. players = int(input())
  6. energy = float(input())
  7. water = float(input())
  8. food = float(input())
  9.  
  10. total_water = water * players * total_days
  11. total_food = food * players * total_days
  12. out_of_energy = False
  13.  
  14. for day in range(1, total_days + 1):
  15.     lost_energy = float(input())
  16.     if energy <= lost_energy:
  17.         out_of_energy = True
  18.         break
  19.     energy -= lost_energy
  20.  
  21.     if day % 2 == 0:
  22.         energy *= 1.05
  23.         total_water *= 0.70
  24.  
  25.     if day % 3 == 0:
  26.         total_food -= total_food / players
  27.         energy *= 1.10
  28.  
  29. if not out_of_energy:
  30.     print(f"You are ready for the quest. You will be left with - {energy:.2f} energy!")
  31. else:
  32.     print(f"You will run out of energy. You will be left with "
  33.           f"{total_food:.2f} food and {total_water:.2f} water.")
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement