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

Talknerdytome

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.

  • one year ago
  • one year ago

  • This Question is Closed
  1. Talknerdytome
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

    • one year ago
    1 Attachment
  2. Talknerdytome
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

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