anonymous
  • anonymous
Python 3 - PS2 - Helper Code I'm doing this class in Python 3 because it's more up-to-date. I tried editing the Helper Code for Hangman, but I can only get it to load 1 word instead of all of the words. I get "Loading word list from file..." and then "1 words loaded." I changed inFile = open(WORDLIST_FILENAME, 'r', 0) to just inFile = open(WORDLIST_FILENAME, 'r') and wordlist = string.split(line) to wordlist = WORDLIST_FILENAME.split(line). I've also tried passing no arguments through split along with whitespace and a few other things as well as using .splitlines etc.
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.
katieb
  • katieb
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
What am I doing wrong/what is the best way to do this in Python 3? I've uploaded my new code and the original code so that it's more clear.
1 Attachment
anonymous
  • anonymous
I figured it out! I was just reading the string 'words.txt' when I created wordlist so it was a list of length one which had one string, 'words.txt.' I updated it to wordlist=line.split() and now get the appropriate statements.

Looking for something else?

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