Advertisement
pacho_the_python

Untitled

Oct 22nd, 2023
728
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. experience_needed = float(input())
  2. battles = int(input())
  3. total_experience = 0
  4. battles_count = 0
  5. is_enough = False
  6.  
  7. for battle in range(1, battles + 1):
  8.     experience = float(input())
  9.     battles_count += 1
  10.  
  11.     if battle % 3 == 0:
  12.         experience += experience * 0.15
  13.  
  14.     if battle % 5 == 0:
  15.         experience *= 0.90
  16.  
  17.     if battle % 15 == 0:
  18.         experience += experience * 0.05
  19.  
  20.     total_experience += experience
  21.  
  22.     if total_experience >= experience_needed:
  23.         is_enough = True
  24.         break
  25.  
  26. if is_enough:
  27.     print(f"Player successfully collected his needed experience for {battles_count} battles.")
  28. else:
  29.     needed_experience = experience_needed - total_experience
  30.     print(f"Player was not able to collect the needed experience, {needed_experience:.2f} more needed.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement