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

ChrisJordan

I'm on lecture 3, however I need some help with the first assignment with the program that asks your your name and d.o.b, I keep getting syntax errors and I have no idea why... Is there a source that can explain all syntax errors on this version of Python?

  • one year ago
  • one year ago

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

    What errors are you getting? Paste your code and I'll try to help you debug it! :)

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

    @ChrisJordan And if you tag me in the post I'll know when you've pasted it. Thanks!

    • one year ago
  3. Larzdk
    Best Response
    You've already chosen the best response.
    Medals 1

    Yes, please post your code. Pastebin is pretty good for that stuff :)

    • one year ago
  4. ChrisJordan
    Best Response
    You've already chosen the best response.
    Medals 0

    Will do as soon as I get off of work at 6pm est.

    • one year ago
  5. tcapaci
    Best Response
    You've already chosen the best response.
    Medals 0

    I've just done this assignment. Without seeing your code, I suppose there are a couple of places that syntax errors may occur. 1. Ensure that you have enough brackets with your raw_input command. 2. Ensure that you enclose your prompt in quote marks. 3. A good idea also is to ensure that your date of birth variable is a string type. I'll give a different example to the assignment: e.g. gen = str(raw_input('Enter your gender:')) Notice two open brackets, two closed brackets. Also notice the quotes around the prompt. Hopefully these are your only errors - when you show the code you will get a definite answer. Cheers

    • one year ago
  6. ChrisJordan
    Best Response
    You've already chosen the best response.
    Medals 0

    NameError: name 'x' is not defined

    • one year ago
  7. ChrisJordan
    Best Response
    You've already chosen the best response.
    Medals 0

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

    I will probably figure out that it is a silly mistake

    • one year ago
  9. tcapaci
    Best Response
    You've already chosen the best response.
    Medals 0

    Hmmm.... It looks like you are using the command line there. Are you using the IDLE GUI to write out your code?

    • one year ago
  10. tcapaci
    Best Response
    You've already chosen the best response.
    Medals 0

    The attached file might help? Please other people let me know if I'm on the complete wrong track too as I'm only new to this too! If you are using a windows machine, download the file, then right click on it and choose "Edit with IDLE". Two windows should open. One is the editor and one is the shell. The example code will hopefully help.

    • one year ago
  11. tcapaci
    Best Response
    You've already chosen the best response.
    Medals 0

    Of course it helps if I attach the file...

    • one year ago
  12. cracker_saba
    Best Response
    You've already chosen the best response.
    Medals 2

    Dear ChrisJordan, I have figured your problem out. The main problem of your code was that you did type a command during the execution of a command. You cannot give command during the execution of another command. When you typed >>>print raw_input('What is you date of birth?") that means your program is expecting a value to set in a variable not defined and here in the place of a value you can not call a function as it would take the function calling command as a string value of a non defined variable.Thus in the next line x has no value assigned,even it doesn't really exist and it gives a error saying x is not defined.You should try writing the following code in the first line of your program which will definitely work >>>x=raw_input("What is your date of birth?\t") remember that you can't use the print method here.But later you can write code like >>>print x My English is not good so thank you very much for reading this comment hope it will help you out.

    • one year ago
  13. ChrisJordan
    Best Response
    You've already chosen the best response.
    Medals 0

    Okay, I think I figured out Problem Set 0 out. Can one of you kind people please take a look at the attached file, let me know if this is correct and sufficient to complete the assignment?

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

    Ahh! Imagine that is what it is except add the word "birth" in lol!

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