Python not working properly

Respected Sir/Madam, I am Dhyan Hariprasad from India and I am new to programming. From the tutorials given in the internet I tried the print command. print “hello world” When I try to execute the command it shows error Sent from Windows Mail

Hi Dhyan, On Fri, Jan 31, 2014 at 5:34 PM, <dhyan.hariprasad@live.com> wrote:
Respected Sir/Madam,
I am Dhyan Hariprasad from India and I am new to programming. From the tutorials given in the internet I tried the print command. print “hello world” When I try to execute the command it shows error
When asking a question such as this, it is always helpful to give which version of Python you are using. In this case, I would guess that you are using Python 3.3, but are reading the tutorial found at docs.python.org/2/tutorial which is meant for Python 2.7. Use the tutorial for Python 3, found at http://docs.python.org/3/tutorial and you should be fine. 'print' was changed from being a statement in Python 2 to being a function in Python 3, which means to use it in Python 3, you have to call it like any other function, like so:
print("Hello, world!") Hello, world!
Hope this helps, -- Zach

On 1/31/2014 6:34 PM, dhyan.hariprasad@live.com wrote:
Respected Sir/Madam, I am Dhyan Hariprasad from India and I am new to programming. From the tutorials given in the internet I tried the print command. print “hello world” When I try to execute the command it shows error Welcome.
print “hello world” Traceback ( File "<interactive input>", line 1
print "hello world" Traceback ( File "<interactive input>", line 1
docs@python.org is for commenting on Python documentation. It's better to ask on help or tutor @python.org Also it is a good idea to tell us what OS you are running, what version of Python, and what you do to edit and run a program. When you get an error (technically an exception) please post the entire traceback. For example: print “hello world” ^ SyntaxError: invalid character in identifier The immediate problem here is the quotes around hello world are not ascii quote characters; they are the quotes you'd see in typesetting. This could be due to the editor you are using or the email program, in which case you retyped the code rather than copy-paste. If you got: print "hello world" ^ SyntaxError: invalid syntax using the correct quotes then you are running Python 3.x in which print is a function, and must be called: print("hello world") BTW Python does not have commands, it has statements.
participants (3)
-
bob gailer
-
dhyan.hariprasad@live.com
-
Zachary Ware