Whats the wrong with that code.? Grader is just unpredictable.
for letter in secretWord:
if letter in lettersGuessed:
MIT 6.00 Intro Computer Science (OCW)
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
this is the get guessed word bit?
have you tried printing this out with some trial entries? you should be able to see the problem
Ok but I think you should print a word in blank or with some letters, if you run that code it should print this:
instead (for 'apple' word) of: _ pp_ e (This is what you need)
@Gianko15 actually that's what I thought, but I just ran it and it does not...
Not the answer you are looking for? Search for more explanations.
I see the problem: that when you are done this prints out spaces between letters, not the actual string that is required to recognize that the words are the same
if you guess all the letters it prints out
h a n d
which your isWordGuessed function probably finds different (depending on how you coded it) due to the spaces.
having the comma after everything is where the spaces are coming from btw
You're right! it does not do that.
I had a similar problem, but I store the output in a list, and add it to ' ' (empty variable), so my output was a string '_ pp_ e', with spaces after the "_" and letters right nex to each other.
I did the same^
however I defined my whole function recursively, so the rest of mine is quite different
I started doing that (recursively), but it was like 3 more lines so I just use a 'for'.
You did it comparing frist word and an [i:] ?? I'm trying to improve my recursively, I made two hangman one is a mess, the other is recursively xD
dont use print.
start with a str - temp = ''
then if ... add char to temp
else add '- ' to temp
yeah something like that, actualy the list I mentioned is not important, after the for return temp, recursively is a simpler way though.
This works fine on my machine shell, but not showing correct output in grader output window..
Maybe it's because the spaces between the letters, if the word is 'apple', it may write "_ p p _ e' instead of '_pp_e'.