You will be given a list of numbers which represent your character's altitude above sea level at regular intervals:
Create a function which returns whether your character survives their unsupervised diving experience, given a list of integers.
Your character starts with a breath meter of 10, which is the maximum. When diving underwater, your breath meter decreases by 2 per item in the array. Watch out! If your breath diminishes to 0, your character dies!
To prevent this, you can replenish your breath by 4 (up to the maximum of 10) for each item in the array where you are at or above sea level.
Your function should return True if your character survives, and False if not.
diving_minigame([-5, -15, -4, 0, 5]) ➞ True
# Breath meter starts at 10.
# -5 is below water, so breath meter decreases to 8.
# -15 is below water, so breath meter decreases to 6.
# -4 is below water, so breath meter decreases to 4.
# 0 is at sea level, so breath meter increases to 8.
# 5 is above sea level and breath meter is capped at 10 (would've been 12 otherwise).
# Character survives!
diving_minigame([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) ➞ True
diving_minigame([-3, -6, -2, -6, -2]) ➞ False
diving_minigame([2, 1, 2, 1, -3, -4, -5, -3, -4]) ➞ False