20th Jun 2022, 8:12 PM
Ronyy
Ronyy - avatar
7 ответов
+ 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.
20th Jun 2022, 8:29 PM
Justice
Justice - avatar
+ 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.
20th Jun 2022, 8:20 PM
Justice
Justice - avatar
+ 1
Ohh ok thankyou! Does anyone have any idea of how can I solve the twice input error in Sololearn?
20th Jun 2022, 8:23 PM
Ronyy
Ronyy - avatar
+ 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
21st Jun 2022, 12:56 AM
Korkunç el Gato
Korkunç el Gato - avatar
+ 1
Thank you very much
21st Jun 2022, 2:05 PM
Ronyy
Ronyy - avatar
0
Im grateful !
20th Jun 2022, 8:31 PM
Ronyy
Ronyy - avatar
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.)
21st Jun 2022, 4:09 PM
Korkunç el Gato
Korkunç el Gato - avatar