Write Your First Python Program

Now that you have installed Python, it’s time to write your first program! Don't worry; it’s very simple, and we'll explain every step so you can understand what’s happening.

Step 1: Open Python

To start, open Python on your system. Here's how you can do it:

Step 2: Write the Program

Type the following line of code into the Python interactive shell (where you see >>>):

print("Hello, World!")
  

Press Enter, and you will see this output:

Hello, World!
  

Step 3: What Does This Program Do?

Let’s break it down to understand what’s happening:

Step 4: Save and Run the Program from a File

Instead of typing code directly into the Python shell, you can write your program in a file and run it. Follow these steps:

Why "Hello, World!"?

The phrase "Hello, World!" is a tradition in programming. It is often the first program beginners write when they learn a new programming language. It’s a simple way to confirm that everything is set up correctly and working as expected.

Congratulations!

You’ve just written and run your first Python program! This is your first step into the world of programming. From here, you can explore more complex tasks and learn new concepts. Keep experimenting and practicing to become a Python pro!