Printing Hello World in Python

Python Programming Tutorials


"Hello, World!" is a simple Python program that outputs the "Hello, World!" string to the screen. When learning a new programming language, it is often used as the first program to write, as it illustrates the basic syntax and structure of the language. This tutorial explains how to print the string Hello, World!" in Python.

In Python, you can write "Hello, World!" using the print function:

Example Program:

print("Hello, World!")

To run this  "Hello, World!" python program, you must install Python on your computer and save the code to a file with a .py extension (e.g., hello.py). Then, you can run the program by using the Python interpreter on the command line, such as:

python hello.py

The above Python program will output the string "Hello, World!" to the screen.

Alternatively, you can also use single quotes to define the string:

Example Program:

print('Hello, World!')

You can also use triple quotes to define a multi-line string, in which case you can use single or double quotes to define the string.

Example Program:

print('''Hello,
World!''')

print("""Hello,
World!""")

Program Output:

D:\python hello.py
Hello,
World!
Hello,
World!


Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram

Notifications

Updates are enabled for this browser.

Receive new tutorials, articles and learning resources. You can turn updates off anytime.

Test browser code

Use this code in admin to send a test notification to this browser.