user2893984
user2893984

Reputation: 1

Novice with Python

I have just downloaded Python 3.3.2 to use on windows7 and run the msi file to install. After installation I have tried using the prog only to find that every time I run my initial print 'hello world' it keeps reporting a syntax error. I have tried both single and double quotes but each time reports a syntax. It will add say 8 + 9 and return the answer but no joy with using a print statement. I have tried both the shell and a new window but without success. Any advice please much appreciated.

Upvotes: 0

Views: 64

Answers (2)

viraptor
viraptor

Reputation: 34205

You're probably using instructions for a python-2 program, where print was a statement, rather than a function. In python >= 3, you have to do print(something), rather than just print something.

Upvotes: 1

tobias_k
tobias_k

Reputation: 82949

If you are using Python 3.x, you have to do print('hello world').

In Python 2.x, print was a statement, like if, for, etc. Now it is a function, thus the ().

Upvotes: 1

Related Questions