0
Can someone tell me whatâs wrong? Get into my code
7 Answers
+ 2
You would need to take it out your code. The objective of your hangman game unfortunately won't work at all because like I said about, you can't take input more than twice on Sololearn, which would be needed for hangman since you need the user to input their guess multiple times.
+ 1
Unfortunately on Sololearn, you cannot take input more than once. You would need to try to execute this in a proper IDE environment through the terminal.
+ 1
Ohh ok thankyou! Does anyone have any idea of how can I solve the twice input error in Sololearn?
+ 1
This code doesn't work on Pydroid either. (1) more input prompting needed (2) how replace works: string.replace(old substring, new substring)
e.g
text = "cleveland street preachers"
text = text.replace("cleveland", "manic")
or if you want to keep the old string:
sent1 = "what is this?"
sent2 = sent1.replace("what", "who")
3) "-" *len(sentence), I'm guessing is what you mean:
new = old.replace(old, "-"*len(old)) # but,
new = "-"*len(old) # already does that.
Here's a code I did earlier. Maybe there's lots of redundancies in it, I really have no idea, I wouldn't know. But there, you can see how I keep asking for input until the word is done or 6 takes are given. You can see what getpass does: It hides the input for another user to take a guess.
This is written for single word guesses, and doesn't display the hangman (nice depiction btw)
It's just here for you to see the getpass module and multiple, interactive input.
https://code.sololearn.com/cjLMA2d49yf2/?ref=app
+ 1
Thank you very much
0
Im grateful !
0
You're welcome. If there's anything unclear you can always ask. (By the way, the getpass module doesn't work on all Python editors. I mean some editors don't have this module.)