Learn Python in 30 Days — Day 1 Your First Python Program

Learn Python in 30 Days — Day 1: Your First Python Program

Welcome to Day 1 of the Learn Python in 30 Days series!
All example files for this series are available on my GitHub: Learn-Python-in-30-Days
Today you’ll write and run your very first Python program using IDLE, the simple editor that installs with Python on Windows.

What You’ll Learn

  • How to install and open Python IDLE

  • How to write and run a simple Python script

  • How to use the print() function

  • How to add comments (#) to explain your code

Step 1 – Install Python 3 (if you haven’t yet)

  1. Visit python.org/downloads.

  2. Click Download Python 3.x.x (the latest version).

  3. Run the installer and most important! tick ✅ “Add Python to PATH” before clicking Install Now.

Once installed, you’ll have both Python and IDLE available from your Start menu.

Step 2 – Open IDLE

  1. Press the Windows key, type IDLE, and open IDLE (Python 3.x 64-bit).

  2. You’ll see a white window titled Python Shell — this is the interactive prompt where you can test code instantly.

Try it now:

print("Hello, world!")

Press Enter and you’ll see:

Hello, world!
That’s your first Python command! 

Step 3 – Create and Run a Python File

Let’s make a proper script instead of just typing into the shell.

  1. In IDLE, go to File → New File

  2. Type the following:

# My first Python program print("Hello, world!")

  1. Click File → Save As…

    • Name it hello.py

    • Save it somewhere easy, like your Documents folder.

  2. Run it with Run → Run Module (or press F5).

A new Python Shell window will appear and show:

Hello, world!

You can see and download this program from my Github hello.py

Step 4 – Understanding the Code

  • print() is a function — it tells Python to display whatever is inside the parentheses.

  • Text in quotes ("...") is a string, meaning literal text data.

  • Lines starting with # are comments they’re ignored by Python and only there to help you (or others) understand the code.

Try changing your code:

# Printing a custom message print("YOUR MESSAGE!")

Then press F5 again to run it.

Step 5 – Experiment in the Python Shell

The Python Shell (the first IDLE window) lets you test quick ideas without saving files.
For example:

>>> print("Testing 1, 2, 3") Testing 1, 2, 3 >>> 2 + 3 5
You can use this space to try tiny experiments before adding them to your main script.

Quick Challenge

Make a new file called introduction.py and have it print:

  • Your name

  • Why you’re learning Python

Example:

# Introduction program
print("Hi, I’m Matty")
print("I’m learning Python basics!")

Save it and run it with F5.

You’ve just written your second Python program!

You can see and download this program from my Github introduction.py

Wrap-Up

Today you learned how to:

  • Install Python 3 and open IDLE

  • Use the Python Shell for quick tests

  • Write and save a .py file

  • Run it with F5

  • Use print() and comments #

All example files for this series are available on my GitHub: Learn-Python-in-30-Days

Tomorrow (Day 2) we’ll cover variables and data types which is how Python stores and handles information.


Comments

Popular posts from this blog

Math Behind Logic Gates

6502 - Part 2 Reset and Clock Circuit

Building a 6502 NOP Test