Python - 12

Python - 12: While Loops

while loops repeat code as long as a condition is true.

✦ Python Editor
▶ Output

👀 Show Example Solution
lives = 3

while lives > 0:
    print("Lives left:")
    print(lives)

    lives = lives - 1

print("Game Over!")