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

giuinha Group Title

how can i get the code in Written Homework #1.13 to run in order to check my answers? when i paste it into either idle or python i get a syntax error.

  • 2 years ago
  • 2 years ago

  • This Question is Open
  1. andrew.m.higgs Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    and Hi Giuinha, Two things to check: is the paste process keeping the correct indentation which is critical in python and have you set the 2 variables (pay and location) correctly. Otherwise is there more information about the error which may help us to debug the problem? Hope this helps in some way.

    • 2 years ago
  2. giuinha Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    well, it's the first line of the code setting the variables that it doesn't like.: pay = _____ location = _____ but now i think maybe it wants us to fill in those banks? i.e. type: pay = 20000 location = 'Massachusetts'

    • 2 years ago
  3. andrew.m.higgs Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Yes. i If you haven't filled in values for location and pay you should get some sort of error. Have you tried to run after setting the variables?

    • 2 years ago
  4. giuinha Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    yes, but i'm still having a problem. first problem is if i copy and paste from the homework assignment into python or idle, it pastes the endire block of code as a single line, so white space is not preserved. also, after i fix the spacing, it's showing SyntaxError: EOL while scanning string literal and highlighting the last quote in this line: if location == "U.S.S. Enterprise":"

    • 2 years ago
  5. andrew.m.higgs Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Remove the " at the end. It is not correct there.

    • 2 years ago
  6. giuinha Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    ok, i did that. now when i try saving the module, i keep getting an I/O warning: non-ASCII found, yet no encoding declared. Add a line like # -*- coding: utf-8 -*- to your file. i can say OK or Edit my file. after it adds that line to the beginning of the file, when i try to run the module python/idle freezes and i have to force quit.

    • 2 years ago
  7. giuinha Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    if i don't add that line, i get a Traceback error: Traceback (most recent call last): File "/Users/jillweisberg/Dropbox/Python MOOC/loc_pay.py", line 1, in <module> if location == "U.S.S. Enterprise": NameError: name 'location' is not defined

    • 2 years ago
  8. giuinha Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    thanks for your help andrew. i'm gonna try again tomorrow, but would still appreciate your help.

    • 2 years ago
  9. andrew.m.higgs Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Any chance you can post your code?

    • 2 years ago
  10. andrew.m.higgs Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Attached is a working copy if you would like to compare to your code. :-)

    • 2 years ago
  11. lh4219 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Try typing the code yourself. its always a good idea to have repetition in something that your learning. In this way you will have proper indentation and syntax. Give it a try it really works.

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