anonymous
  • anonymous
PS2 - Hangman What do you think of this solution? http://dpaste.com/776959/
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 :)
SOLVED
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.
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
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/
anonymous
  • anonymous
Fixed the missing 'w': http://dpaste.com/776970/ Yes it works. This is the word.txt file.
1 Attachment
anonymous
  • anonymous
when i run it, it only loads one word from the file.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
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.
anonymous
  • anonymous
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.
anonymous
  • anonymous
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.
anonymous
  • anonymous
ahh, nevermind - i had the file from the 2008 class
anonymous
  • anonymous
So does the code work? Except the remove character solution (yours is simpler), do you have any comments on sections that could be improved?
anonymous
  • anonymous
the enumerate() function is convenient when you need to iterate over the items and the indices of a sequence - http://dpaste.com/776981/
anonymous
  • anonymous
Where can I use that?
anonymous
  • anonymous
I was looking at format_word() when i thought of that.
anonymous
  • anonymous
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.
anonymous
  • anonymous
otherwise looks good to me
anonymous
  • anonymous
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.
anonymous
  • anonymous
i'm thinking though (and remembering) that slices can be very powerful - i need to start remembering to consider them as an option.

Looking for something else?

Not the answer you are looking for? Search for more explanations.