LESSONS · 12 · 01 / 12
Python Setup and First Steps
Get Python running and write your first programs. Learn about the Python ecosystem and interactive development.
TIPLearning Objectives: After this lesson, you'll understand what Python is, why it's popular, and be able to write and execute your first Python programs using interactive tools.
What is Programming? A Chef's Perspective
Programming is like writing recipes for a very literal robot chef. Your code is the recipe, Python is the chef that follows it exactly, your data is the ingredients, and the output is the dish. The catch: the chef has zero common sense.
Assemble the recipe below and run the robot. Make a step vague, reorder the steps, or empty the pantry — and watch precisely where it breaks.
A good recipe — and a good program — has to be precise (exact amounts), sequential (the right order), unambiguous (no "stir until done"), and complete (nothing missing). Break any one of these and the robot stalls. That's all programming really is: precise, unambiguous instructions a literal machine can follow.
What is Python?
Python is a high-level, interpreted programming language known for its simplicity and readability. Created by Guido van Rossum in 1991, Python has become one of the most popular programming languages in the world.
Why Python is like a friendly chef:
- It understands instructions written in near-English
- It gives helpful error messages when confused
- It handles many technical details automatically
- It's forgiving for beginners but powerful for experts
Why Python is Special
| Feature | Description | Example |
|---|---|---|
| Simple Syntax | Code reads like English | if age >= 18: print("Adult") |
| Interpreted | No compilation needed | Run code immediately |
| Versatile | Web, data science, AI, automation | Django, pandas, TensorFlow |
| Large Community | Extensive libraries and support | 300,000+ packages on PyPI |
Your First Python Program
print() is how Python shows output. The classic first line is print("Hello, World!") — here it is, plus a couple more lines so you can see print() handle text and math. Press Run, then change something and run again — it's yours to edit:
🎉 Congratulations! You just ran your first Python program. Notice how:
print()displays text and values- Text (strings) are wrapped in quotes
- Python can do math calculations
- Comments start with
#
Python as a Calculator
Python excels at mathematical operations. Try these examples:
Working with Text
Python makes it easy to work with text (called "strings"):
Python's Philosophy
Python has a famous design philosophy, "The Zen of Python." A few principles that shape the language:
- Beautiful is better than ugly - Code should be pleasant to read
- Simple is better than complex - Prefer straightforward solutions
- Readability counts - Code is read more often than written
Common Python Use Cases
Python is used everywhere in technology:
🌐 Web Development
- Frameworks: Django, Flask, FastAPI
- Companies: Instagram, Spotify, Dropbox
📊 Data Science & Analytics
- Libraries: pandas, NumPy, matplotlib
- Companies: Netflix, Uber, Airbnb
🤖 Artificial Intelligence
- Libraries: TensorFlow, PyTorch, scikit-learn
- Applications: ChatGPT, image recognition, recommendation systems
🔧 Automation & Scripting
- System administration
- Web scraping
- Task automation
Your Development Environment
In this course, we're using an interactive Python environment that lets you:
- ✅ Write and run code instantly
- ✅ See results immediately
- ✅ Experiment without setup
- ✅ Learn through hands-on practice
Practice Exercises
Try these exercises to reinforce what you've learned:
Exercise 1: Personal Introduction
Exercise 2: Simple Calculator
Key Takeaways
✅ Python is beginner-friendly - Simple syntax that reads like English
✅ Interpreted language - Run code immediately without compilation
✅ Versatile - Used in web development, data science, AI, and automation
✅ Interactive - Perfect for learning and experimentation
✅ print() - Your primary tool for displaying output
✅ Comments - Use # to document your code
Connections: Programming Languages and Beyond
🔗 Connection to Other Programming Languages
Python is part of a large family of programming languages. Here's how it compares:
| Python | JavaScript | Java | C++ |
|---|---|---|---|
print("Hello") | console.log("Hello") | System.out.println("Hello") | cout << "Hello" |
| No compilation | No compilation | Compiles to bytecode | Compiles to machine code |
| Interpreted | Interpreted | Hybrid | Compiled |
| Dynamically typed | Dynamically typed | Statically typed | Statically typed |
Python's Philosophy:
- Readability: Code should be easy to read (unlike Perl)
- Simplicity: One obvious way to do things (unlike C++)
- Batteries included: Rich standard library (unlike C)
🔗 Connection to Computer Science
Python helps you learn fundamental CS concepts:
- Algorithms: Step-by-step problem solving
- Data structures: Organizing information efficiently
- Logic: Boolean reasoning and decision making
- Abstraction: Hiding complexity behind simple interfaces
🔗 Connection to Your Future Learning
This is just the beginning of your Python journey:
- Next lesson: Variables and data types (your program's memory)
- Soon: Functions and classes (organizing your code)
- Later: Web development, data science, or AI (applying Python)
- Eventually: Building your own applications and tools!
Remember: Every expert programmer started exactly where you are now - with print("Hello, World!")!
Next Steps
In the next lesson, we'll dive deeper into variables and data types - the building blocks of all Python programs. You'll learn how Python stores and manages different types of data in memory.
Ready to continue? The next lesson will show you how Python handles data with variables and introduce you to Python's built-in data types.
Further Reading
Interactive Playgrounds
- Python Tutor — Visualize Python Code Step-by-Step — single most useful tool for beginners. Paste any Python program and watch variables, lists, and function calls update line-by-line with arrows showing exactly what's pointing to what.
- Replit & Google Colab — full Python environments in your browser, no install required.
- learnxinyminutes — Python — the entire language as one annotated cheat-sheet you can scroll in 10 minutes.
Official & Free Books
- Python Documentation — Tutorial — the official tutorial, written by the Python core team. Authoritative.
- Automate the Boring Stuff with Python — Al Sweigart, free online. The friendliest first book.
- Think Python (3rd ed.) — Allen Downey, free. Computer-science angle.
- The Hitchhiker's Guide to Python — Kenneth Reitz et al. Best practices and ecosystem overview.
Modern Tooling (use these, not the old pyenv/virtualenv dance)
- uv — Astral's modern Python package + project manager. Drop-in replacement for
pip,pip-tools,pyenv,poetry. Written in Rust, ~10× faster. - Ruff — formatter + linter that replaces
black,flake8, andisortin one tool. Also from Astral. - VS Code Python Extension — the most popular Python editor setup, with the official tutorial.
Video & Community
- Real Python — First Steps With Python — the canonical "your first Python" article online.
- Corey Schafer's Python Tutorials — clearest video series for beginners.
- r/learnpython & Python Discord — beginner-friendly help communities.