Computer >> Computer tutorials >  >> Programming >> Python

How to print Hello World! using Python?


The basic way to do output to screen is to use the print statement.

>>> print 'Hello, world'
Hello, world

To print multiple things on the same line separated by spaces, use commas between them. For example:

>>> print 'Hello,', 'World'
Hello, World

In Python 3, all print is a function and not a statement. Hence its arguments need to be surrounded by parenthesis. For example,

>>> print("Hello", "world")
Hello world