← back to unit
Medium
# breaking it down medium
Boss Battle
Your attack combo repeats until the boss falls. 🐲
You get the boss hp and your attack pattern (damage numbers you cycle through, starting over when it ends). Each round deals the next attack. Print the number of rounds until hp drops to 0 or below.
Example:
Input: hp = 20, pattern = [3, 5]
Output: 6
Cycling 3, 5, 3, 5, 3, 5 deals a running total of 3, 8, 11, 16, 19, 24 — hp drops to 0 or below on round 6.
💡 need a hint?
brk-boss-battle.py🔒 given lines are locked — write your code in between
loading...