Introduction to Python: Your First Program
Write a simple 'Hello, World!' program and set up a Python environment.
Introduction to Python: Your First Program 🐍
Hey there! Ready to start your Python journey? Let's get you set up and running your first program. Don't worry - it's way easier than you think!
Getting Python on Your Computer
First things first - let's make sure Python is installed.
Windows Users:
- Head to python.org/downloads
- Download the latest version
- Important: Check the box that says "Add Python to PATH" during installation (don't skip this!)
Mac Users:
Good news - Python 3 usually comes already installed on your Mac!
Check if you have it by opening Terminal and typing:
python3 --version
No Python? No problem. Install it with Homebrew:
brew install python
Linux Users:
You probably already have Python installed. Check by typing:
python3 --version
Writing Your First Program
Alright, Python's installed. Now the fun part!
Open any text editor you like (VS Code, PyCharm, or even just Notepad - whatever works for you).
Create a new file called hello.py and type this in:
print("Hello, World!")
Save it, then open your terminal/command prompt in the same folder and run:
python hello.py
If you see this:
Hello, World!
You did it! You're officially a Python programmer now!
So What Just Happened?
That print() thing is a function - basically a command that tells Python "hey, show this on the screen."
Whatever you put inside those quotes gets displayed exactly as you typed it.
Try it:
print("Python is awesome!")
Output:
Python is awesome!
Things to Remember
- Save before running - seems obvious but we all forget sometimes!
- Indentation matters in Python - unlike other languages, spacing isn't just for looks
- Experiment! Change the message, add more print statements, break stuff and fix it - that's how you learn
What's Coming Next?
You just crossed the biggest hurdle - actually running code! From here, you'll learn about variables, doing math, making decisions with if-else, and way more cool stuff.
The key is to keep playing around with it. Every programmer started exactly where you are right now. You've got this!