I am trying to run my first program/script (pardon my bad terminology, I am a newbie), and just doesn't work. I am using Ubuntu, and IDLE. and I have written:

print "Hello, world!"

I saved the file as hello.py. Tried to click Run - Run Module, but then it says "Invalid syntax".
Also tried to write "python hello.py" in the python shell, but then I got:
SyntaxError: invalid syntax (<pyshell#13>, line 1)

Anyone knows how to get my program to work? Would really appreciate the help.

Recommended Answers

All 3 Replies

print("Hello World") You are probably using Python 3.

alternatively, you could just press F5 while inside IDLE

Thank you very much! It worked when I added ().

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.