Skip to content
DeepForgeby svx
All problems

Episodic Life Tracking

Problem

Track remaining lives after a sequence of damage events, clamping at zero: max(0, initial_lives - sum(damage_events)).

Hint

Lives never go negative even if more damage events are logged than lives remain.

Test cases

case 1
in: [3,[1,1]]
expected: 1
case 2
in: [3,[1,1,1,1]]
expected: 0
case 3
in: [5,[]]
expected: 5
Starter codePython
def episodic_life_tracking(initial_lives, damage_events):
    # Your code here
    pass

3 test cases · run your code against them in the editor