Site icon TestingDocs.com

First Python Program : Hello World!

Overview

This guide will teach you how to write your first Python program. Traditionally, the first program written in a new language is the Hello, World! program, which displays a message on the screen.

First Python Program

While you can write Python scripts in any text editor, an Integrated Development Environment (IDE) can make coding easier. In this tutorial, we will use Python IDLE.

The IDLE (Integrated Development and Learning Environment) is a GUI (Graphical User Interface) tool. It is also installed when you install Python. You can use it to run Python on your computer. It’s an interactive GUI IDE tool intended for beginners.

The IDLE tool provides the programmer with useful features like syntax highlighting, code hinting and checking, file explorers, etc., for program development.

Writing Your First Python Program

Launch Python IDLE editor.

Start Menu >> Python >> IDLE (Python <version> 64-bit)

When you open IDLE, an interactive Python Shell is opened.

Create a new Python script file. Select File >> New File from the menu.

Write the Hello World Python program.

print(“Hello, World!”)

To display the Hello, World! string in the Python language, we need to write a single print() statement. The print() function displays the text on the screen. The quotation marks in the statement at the beginning and end of the string don’t appear in the result.

Save the file using the File > Save menu option. Save the file with a .py extension, like hello_world.py.

Run the Python program.

Go to Run > Run Module or click F5 to run the file.

IDLE shell will then execute the program and display the output.

 

That’s it. Congratulations on successfully writing and executing your first Python program using the IDLE tool.

Python Tutorials

Python Tutorial on this website can be found at:

https://www.testingdocs.com/python-tutorials/

More information on Python is available at the official website:

https://www.python.org

Exit mobile version