Python Guess Number Not Working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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? https://code.sololearn.com/cmVPGQ7RKG2n/?ref=app

24th Sep 2019, 6:32 PM
Code Babylon
Code Babylon - avatar
3 Answers
+ 2
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!
25th Sep 2019, 3:31 AM
David Ashton
David Ashton - avatar
0
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
25th Sep 2019, 3:34 AM
Code Babylon
Code Babylon - avatar
0
David Ashton I added the rest of the code. Do you mind checking it again? Also, what do you mean by "nonbreaking spaces"?
25th Sep 2019, 3:36 AM
Code Babylon
Code Babylon - avatar