A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

my python will not run a program. it will always think that the heading is a syntax error. What can i do?

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    code please.

  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    i didnt even write any code. all i entered as a test was print ('hello world') which return the syntax error and when i clicked ok to see the error it highlighted the 5 in the header that said 2.5.1

  3. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Did you make sure you commented out your header?

  4. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    sadly i have no idea what that means

  5. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Put a # before any text and that makes it a comment. Comments are used for code that you want people to read and not the computer.

  6. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    #hello.py # Get the user's name and print a friendly hello name = raw_input("Please enter your name ") print "Hello", name, "- good to see you!"

  7. carlsmith
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Don't bother with the header at first, it's only there to let the computer know which interpreter to use. Unless you have a Python3 interpreter as the default, which is unlikely, it'll just use whatever you have set up, probably Python2.6 or 7 anyway. You can always specify an interpreter at the command line. python2 ~/scripts/myapp.py By the way, unless you've done from __future__ import print_function you shouldn't add parenthesis to your print statements. print('hello world') means print a tuple containing one object, the string 'hello world'. It should print ('hello world') In Python2 we just do print 'hello world' Note, print is a keyword in P2, but a function in P3 so print('hello world') in P3 does actually mean print the string 'hello world' (by calling the print function on it).

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

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

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.