What is the error for? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
5 Answers
+ 9
@Rapheal: Even I'm not good at Python, still making my best attempt. That depends on when you want the player's health to be decreased. Just terminate the loop (using break) as soon as the health becomes 0 and ask the user if he wants to play the game again. For some information on break, https://www.programiz.com/python-programming/break-continue # Something like : if health == 0: break
30th Jan 2018, 6:19 PM
Dev
Dev - avatar
+ 11
Just remove the indentation at line 48 and 49 i.e bring both the print statements to the extreme left. Another problem is time limit exceeded, which is because your code runs forever. You need to stop it somewhere.
30th Jan 2018, 6:08 PM
Dev
Dev - avatar
+ 2
I know, I still haven't reached that part..Thanks anyway!
30th Jan 2018, 6:09 PM
Raphael Shay
Raphael Shay - avatar
+ 1
I'm actually pretty new to coding and Python in general.. How would I close the loop and still repeat the whole "turns" loop until someone looses all his health?
30th Jan 2018, 6:14 PM
Raphael Shay
Raphael Shay - avatar
+ 1
Thanks
30th Jan 2018, 6:21 PM
Raphael Shay
Raphael Shay - avatar