Ace school

with brainly

  • Get help from millions of students
  • Learn from experts with step-by-step explanations
  • Level-up by helping others

A community for students.

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)
See more answers at brainly.com
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.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

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
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.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Not the answer you are looking for?

Search for more explanations.

Ask your own question