Learn Python in 30 Days — Day 1 Your First Python Program
Learn Python in 30 Days — Day 1: Your First Python Program
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)
-
Visit python.org/downloads.
-
Click Download Python 3.x.x (the latest version).
-
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
-
Press the Windows key, type IDLE, and open IDLE (Python 3.x 64-bit).
-
You’ll see a white window titled Python Shell — this is the interactive prompt where you can test code instantly.
Try it now:
Press Enter and you’ll see:
Step 3 – Create and Run a Python File
Let’s make a proper script instead of just typing into the shell.
-
In IDLE, go to File → New File.
-
Type the following:
-
Click File → Save As…
-
Name it hello.py
-
Save it somewhere easy, like your Documents folder.
-
-
Run it with Run → Run Module (or press F5).
A new Python Shell window will appear and show:
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:
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:
Quick Challenge
Make a new file called introduction.py and have it print:
-
Your name
-
Why you’re learning Python
Example:
Save it and run it with F5.
You’ve just written your second Python program!
Wrap-Up
Today you learned how to:
-
Install Python 3 and open IDLE
-
Use the Python Shell for quick tests
-
Write and save a
.pyfile -
Run it with F5
-
Use
print()and comments#
Tomorrow (Day 2) we’ll cover variables and data types which is how Python stores and handles information.









Comments
Post a Comment