Your First Python Program
Welcome to the exciting world of Python programming! If you’re reading this, you’re probably eager to write your first Python program. Don’t worry, we’ve got you covered. In this tutorial, we’ll guide you through the process of writing and running your first Python program. Let’s get started!
Table of Contents
Set Up Your Environment
Before you start coding, you need to set up your Python environment. If you haven’t installed Python yet, you can download it from the official Python website. You can also use an Integrated Development Environment (IDE) like Thonny, which comes with Python bundled in it. Once you’ve installed Python, you’re ready to start coding!
Write Your First Python Program
Now that we have Python up and running, we can write our first Python program. We’ll start with the classic “Hello, World!” program. This is a simple program that prints the text “Hello, World!” to the console.
Here’s what the code looks like:
print("Hello, World!")
PythonUnderstanding Your First Python Program
Let’s take a moment to understand what’s happening in our “Hello, World!” program. The print
function is a built-in Python function that prints the specified message to the screen. The message can be a string, or any other object, the object will be converted into a string before written to the screen. In our program, the message is the string “Hello, World!”.
Run Your First Python Program Online: Easiest Way

- Select Language Python
- Copy and paste above code

- Click “Run the Code”.

Run Your First Python Program in Your Computer
You can type this code into any text editor or IDE and save it as hello_world.py
. The .py
extension indicates that this is a Python file.
Example on Windows with Notepad, installed python and Command Prompt or PowerShell
You can use just Window’s notepad to create your first code:
- On Windows, click “Start” menu and search “Notepad”. After opening the file, please paste above code.

- Save the file as “hello.py”. Make sure to set “Save as type:” as “All files” as below:

Using Command Prompt to Run Python code
Here are the detailed steps:
- Open Command Prompt. For that, you can click “Start” and search for “cmd”.
- Use the command “cd <your folder where you have put hello.py> to go the directory where you have put your python file hello.py. In following example, we have used the command to go the folder where we have put hello.py.
cd C:\Users\shish\OneDrive\Documents\Python_Practice

- Then run the python file using the following command.
python hello.py
- You will see the desire output as shown in the above figure.
Using Windows PowerShell to Run Python Code
Alternatively, you can use PowerShell as well. See below.

Run Your First Program on Jupyter Notebook
Using Jupyter Notebook is a more common way to run Python code. See the next tutorial article to know how to do that.
Let’s take a moment to understand what’s happening in our “Hello, World!” program. The print
function is a built-in Python function that prints the specified message to the screen. The message can be a string, or any other object, the object will be converted into a string before written to the screen. In our program, the message is the string “Hello, World!”.
Expanding Your First Python Program
Now that you’ve written your first Python program, you can start to expand on it. For example, you could modify the program to print a different message, or to print multiple messages. Here’s an example:
print("Hello, World!")
print("Welcome to Python programming!")
PythonWhen you run this program, it will print two lines of text to the console:
Hello, World!
Welcome to Python programming!
PythonAs you can see, Python makes it easy to print messages to the console. But Python is capable of much more than just printing messages. As you continue to learn Python, you’ll discover that it’s a powerful language that can be used for a wide range of tasks.
Related Tutorials
Dr. Mehedi Hasan is a seasoned semiconductor professional, academic and web-designer with over a decade of experience in digital system design and verification as well as web development. Currently a Senior Engineer at AMD in Markham, Ontario, he plays a key role in the development and verification of cutting-edge chip technologies, earning multiple Spotlight Awards for his contributions.
Dr. Hasan holds a Ph.D. in Electrical and Computer Engineering from the University of Saskatchewan and has served in both academia and industry across Canada, Bangladesh, Malaysia, and Saudi Arabia. His expertise spans web-development, UVM-based SystemVerilog verification, static timing analysis (STA), RTL design, and scripting in multiple languages including Python, TCL, Shell as well as web-development tools including HTML, CSS, Javascript.
Passionate about knowledge sharing and education, Dr. Hasan has also worked as an Assistant Professor in Ontario, Canada (at Lakehead University) and Bangladesh University. He is committed to building accessible learning environments and is the founder of SkillSeminary, a platform focused on simplifying complex tech concepts for learners worldwide.
When he's not immersed in chip verification or educational projects, Dr. Hasan enjoys mentoring, researching system development, and promoting open tech education.