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

David_Novo Group Title

PS2 - Hangman What do you think of this solution? http://dpaste.com/776959/

  • one year ago
  • one year ago

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

    does it work? - nope - how many words are in words.txt? available is missing a letter here is another way to remove a character from a string - http://dpaste.com/776965/

    • one year ago
  2. David_Novo Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Fixed the missing 'w': http://dpaste.com/776970/ Yes it works. This is the word.txt file.

    • one year ago
    1 Attachment
  3. bwCA Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    when i run it, it only loads one word from the file.

    • one year ago
  4. David_Novo Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    That part was given. Students just have to code below ''your code begins here''. You just need a one random word each time you play Hangman.

    • one year ago
  5. bwCA Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    when you run it, it works? well, load_words is not working, you need to fix it before the game will work. it only loads the first word in the file.

    • one year ago
  6. David_Novo Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    load_works was written by the TA's as it was give with the problem handout. When I run load_words I get 55900 words.

    • one year ago
  7. bwCA Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    ahh, nevermind - i had the file from the 2008 class

    • one year ago
  8. David_Novo Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    So does the code work? Except the remove character solution (yours is simpler), do you have any comments on sections that could be improved?

    • one year ago
  9. bwCA Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    the enumerate() function is convenient when you need to iterate over the items and the indices of a sequence - http://dpaste.com/776981/

    • one year ago
  10. David_Novo Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Where can I use that?

    • one year ago
  11. bwCA Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    I was looking at format_word() when i thought of that.

    • one year ago
  12. bwCA Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    i like to use lists because they have lots of useful methods. I might have kept the word as a list of characters and worked with that instead of slices. For some reason, i never think about using slices.

    • one year ago
  13. bwCA Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    otherwise looks good to me

    • one year ago
  14. David_Novo Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Using lists instead of slices really seems a great idea. It's way more easy to work with lists than with strings. Thanks for the tip.

    • one year ago
  15. bwCA Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    i'm thinking though (and remembering) that slices can be very powerful - i need to start remembering to consider them as an option.

    • one year 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.