Introduction to Python: Running Your First Program (Beginner Guide)

Python is a beginner-friendly programming language used to give instructions to a computer. With Python, you can build websites, applications, games, automation tools, and even systems used in artificial intelligence and data analysis. Python is popular because its commands are easy to read and understand, making it suitable for students and first-time learners.

Before a computer can follow Python instructions, two things must happen:

  1. Python must be installed on the computer

  2. The instructions must be written and run correctly

In this lesson, you will learn how to run your first Python program step by step, even if you have never coded before.

Step 1: Confirm that Python is Installed

  1. Press the Windows key on the keyboard.

  2. Type cmd.

  3. Press Enter.

A black window called Command Prompt will open. This window allows you to communicate directly with the computer.

  1. Type:

    python
  2. Press Enter.

What you should see

If Python is installed correctly, you will see:

  • The Python version number

  • A symbol that looks like this:

    >>>

This means Python is ready to accept commands.

  1. Type:

    exit()
  2. Press Enter to close Python.

Step 2: Open a Text Editor to Write Code

Python programs are written as plain text.

  1. Press the Windows key.

  2. Type Notepad.

  3. Press Enter.

A blank page will open. This is where you will write your Python code.

Step 3: Write Your First Python Code

In the Notepad window, type exactly:

print("Hello, World")


Explanation of the code

  • print
    This is a Python command that tells the computer to display something on the screen.

  • "Hello, World"
    This is the message you want Python to display.

    • The quotation marks tell Python that the words are plain text.

    • Without quotation marks, Python will think the words are commands and show an error.

So this line means:
“Display the text Hello, World on the screen.”

Step 4: Save the File Correctly

Saving the file correctly is very important.

  1. Click File in Notepad.

  2. Click Save As.

  3. Choose Desktop.

  4. In the File name box, type:

    hello.py
  5. In Save as type, select:

    All Files
  6. Click Save.

Why this step matters

  • .py tells the computer that this file contains Python code.

  • If the file is saved as .txt, Python will not run it.

Step 5: Open Command Prompt and Locate the File

  1. Press Windows key + R.

  2. Type:

    cmd
  3. Press Enter.

Command Prompt will open again.

  1. Type:

    cd Desktop
  2. Press Enter.

Explanation

  • cd means change directory

  • You are telling the computer to move to the Desktop, where your Python file is saved

Step 6: Run Your First Python Program

  1. Type:

    python hello.py
  2. Press Enter.

Step 7: View the Output

If everything is done correctly, you will see:

Hello, World

This output means:

  • Python successfully read your file

  • Python understood the instruction

  • Python executed the code

You have just run your first Python program.

What You Have Learned

By completing this lesson, you have learned how to:

  • Write a simple Python command

  • Save a Python file correctly

  • Use the Command Prompt

  • Run Python code

  • Understand basic program output

This is the foundation of programming. Every software application begins with steps like these.

Important Note for Beginners

Making mistakes is normal.

  • Errors mean you are learning.

  • Always check spelling, file name, and file location.

  • Take your time and follow each step carefully.

Watch the video below to see a clear, step-by-step explanation of what we’ve discussed above