Python Guess Number Not Working | Sololearn: Learn to code for FREE!


Python Guess Number Not Working

I'm trying to tell the program that after 6 guesses it needs to stop, but it keeps running after 6 guesses. Can anyone see what I'm doing wrong?

9/24/2019 6:32:38 PM

Code Babylon

4 Answers

New Answer


I presume you copied and pasted this code from somewhere. For starters, it is full of nonbreaking spaces (I found 242), which can mess up the code. They should be converted to ordinary spaces. Line 5 should be indented. If you are going to use random.randint() you have to import random first. You are calling 3 functions that have never been defined: Main_Menu(), Inside() and HSPlay(). I would go back to where you got the code from and make sure you copy the whole thing then paste it as plain text into MS Word and then format it to match the original code without any special characters, then paste it into the Code Playground. You are going to encounter another set of problems caused by SoloLearn's requirement that all inputs must be simultaneous, i.e. there can be no sequential interactive inputs, but you can get it to work if you paste it into a different editor/IDE like Pydroid3 for Android or VS Code for Windows. Good try so far - check back and post what you've got if you still have problems!


David Ashton You're right in saying I should have posted the whole code. I'll fix that now. I do use VS Code for all of my Python codes


David Ashton I added the rest of the code. Do you mind checking it again? Also, what do you mean by "nonbreaking spaces"?