On January 21th at 14:15 UTC , progression through exercises will be unavailable for 10 minutes due to a planned maintenance break.
Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Cyber Battle Game
Game elements
Main Game Loop
10. Step 6c – displaying a verdict
Final game


Great! Now it's time to display the verdict!

Keeping your code inside functions is a programming best practice. That's why we should now create a main() loop that takes care of the game's primary logic.


Display a verdict. Instead of always printing '*** Draw! ***', do the following operations inside the main() function:

  1. If robot A has more than 0 lives and robot B has 0 lives, print
    *** Robot A won! ***
  2. If robot B has more than 0 lives and robot A has 0 lives, print
    *** Robot B won! ***
  3. Otherwise, print
    *** Draw! ***