Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

AjinkyaJ Group Title

Whats the wrong with that code.? Grader is just unpredictable. for letter in secretWord: if letter in lettersGuessed: print letter, else: print'_',

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. TuringTest Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    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

    • 2 years ago
  2. Gianko15 Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    Ok but I think you should print a word in blank or with some letters, if you run that code it should print this: _ p p _ e instead (for 'apple' word) of: _ pp_ e (This is what you need)

    • 2 years ago
  3. TuringTest Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    @Gianko15 actually that's what I thought, but I just ran it and it does not...

    • 2 years ago
  4. TuringTest Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    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

    • 2 years ago
  5. TuringTest Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    if you guess all the letters it prints out getGuessedWord('hand', ['a','h','n','d']) h a n d which your isWordGuessed function probably finds different (depending on how you coded it) due to the spaces.

    • 2 years ago
  6. TuringTest Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    having the comma after everything is where the spaces are coming from btw

    • 2 years ago
  7. Gianko15 Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    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.

    • 2 years ago
  8. TuringTest Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    I did the same^ however I defined my whole function recursively, so the rest of mine is quite different

    • 2 years ago
  9. Gianko15 Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    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

    • 2 years ago
  10. stamgolesh Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    dont use print. start with a str - temp = '' then if ... add char to temp else add '- ' to temp return temp ok?

    • 2 years ago
  11. Gianko15 Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    yeah something like that, actualy the list I mentioned is not important, after the for return temp, recursively is a simpler way though.

    • 2 years ago
  12. AjinkyaJ Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    This works fine on my machine shell, but not showing correct output in grader output window..

    • 2 years ago
  13. Gianko15 Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    Maybe it's because the spaces between the letters, if the word is 'apple', it may write "_ p p _ e' instead of '_pp_e'.

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.