[Solved]Python - why "Game Over" never get printed? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

[Solved]Python - why "Game Over" never get printed?

Could you help me figure out why"Game Over" never get printed out? https://code.sololearn.com/cl4mS2SxBJiM/?ref=app

8th Dec 2021, 1:30 AM
Lea
Lea - avatar
2 Answers
+ 5
See line number 7 your condition here you pass two value one is string type another one 3 and u calling function 3 time After if condition value are decrementing by 1 if self._lives > 0: self._lives -= 1 Initially value was 3 in First call then value decrement now value is 2 then again decrement then 1 again decrement but now Your condition is failed Becz value is always greater than 0 pass as a argument instead of 3 pass 2 u will see game over will print one times
8th Dec 2021, 1:41 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 3
Oh..... I got it! I'm so bad at counting lol. Thank you @Inactive
8th Dec 2021, 1:55 AM
Lea
Lea - avatar