Can someone debug this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
21st Oct 2017, 1:41 PM
Poet🎭
Poet🎭 - avatar
2 Answers
+ 1
There's nothing wrong with your code, it runs and does what you think it does, the problem is the way sololearn handles input. Take what you have there and drop it into http://www.Repl.it/languages/python3, you'll see it works no problem. Having said that there are some things that, while they don't break your game, are unnecessary. For example, you set found and randomNumber both inside and outside the main() function. Keep them local to the function and get rid of the others and you save maybe 5 bytes of memory (roughly). Also, the exception for eof will fire for empty input, but won't catch a string attempting to be cast as an int. These are little issues, you've made a nice little app here.
21st Oct 2017, 5:19 PM
Nic
+ 4
@NicLol Its not even my code😂, someone said I should try and debug it(which I did that is the fixed version) but then I noticed it wasn't running and there was pretty much no problem and it was running perfectly on qpython.
21st Oct 2017, 6:58 PM
Poet🎭
Poet🎭 - avatar