How to print Hello World

Write the program

print() sends text and other values to standard output. Strings may use single or double quotes.

print("Hello, World!")

Run the file

Save the code as hello.py, then run it from the same directory. The text should appear on a new line.

python3 hello.py
# Windows:
py hello.py

Print several values

Separate arguments with commas. Python converts each value to text and inserts a space between arguments by default.

language = "Python"
version = 3
print("Learning", language, version)

Control the separator and ending

The optional sep and end arguments change how output is joined. This example prints one line.

print("red", "green", "blue", sep=", ", end="!\n")