#help with hangman project
32 messages · Page 1 of 1 (latest)
@gusty quest
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
!title help with hangman project
help with hangman project
Hello @gusty quest, please follow all the instructions in this message ^
Please read the DM that the bot sent you.
what's the problem? what exactly happens? and what would you expect to happen?
ok so
for my code its a hangman game. And the main issue is that once you guess the correct letters the code wont print the team
i expect that once you guess all the correct letters it should print th team you guessed
nothing it just asks to input another letter
the thing is, you never update fullword. So, at the end, when you're checking if fullword == selectedteam, you're actually doing something like "_______" == "arsenal", which obviously isn't true. you need to figure out how to update fullword to have the guessed letters filled :)
so how would i do that?
there's a couple ways. One, you could check where in the selectedteam string you have the guessed letter, and replace those indices in fullword with the letter.
Another way, which I'd use, is a set. Do you know what that is / how to use it?
No ðŸ˜
ok then, maybe leave it for a latter learning, and try the first way I told you
ok
since your project is for tomorrow
ord_as_list = list(fullword)
Decide = [i for i, letter in enumerate(word) if letter == guess1]
print(display_hangman(attempts)) Would I change this part in the code? also how I change the indices in fullword.
if possible could you give me a more simple way to fix it I don't really understand. @empty falcon
sorry I had to leave for a while
but if you change this part to use fullword instead of Decide, that will start your progress :)
fullword = [i for i, letter in enumerate(word) if letter == guess1]
print(display_hangman(attempts))
if attempts == 0:
print("you lose")
print(selectedteam) - what else would I change?
sorry for asking so much btw im kinda lost on how to fix this ðŸ˜
sorry to ping but I really need to fix this issue quickly could you help? @vocal geyser
yeah ofc no problem, that's normal :) I'm sorry I'm not really helping you though, I'm kinda busy and answering in some pauses
print what you have as fullword here and compare to what you want it to be
could u give an example code on what that would look like pls