Search code examples
pythonraw-input

Python Newbie MIT 6.00 raw_input syntax error


I've finally got enough motivation to see through the MIT's Opencourse Intro to Computer Science & Programming, Fall 2008. I'm doing this online watching video lectures. Lecture #3 consists of Problem Set #0: Printing Your Name.

I can't believe it, but I'm really stuck on the first line of the first problem.

I need to create a program to ask my last name. So I checked out some online ref. and came to this code:

print raw_input('What is your lastname?')

However, that was giving a SyntaxError: invalid syntax. So I read up a bit more and found out that it's probably because I'm using Python 3.2.2. And that I'm to replace the raw_input() to just input(). However, same SyntaxError: invalid syntax remains.

Does anyone have enough patience to help? :)


Solution

  • in python 3.x you use function print() not the keyword print.