Module 01 โ Introduction & Setup
What Python is, why half the internet runs on it, and getting your machine ready to write real code.
Prerequisite: None โ this is genuinely where everyone starts.
After this lesson, you will be able to
- Explain what Python is and why it's a popular first language
- Install Python 3 and confirm it works from a terminal
- Install VS Code and connect it to Git Bash
- Write, save, and run your very first .py file
Concept & Syntax
Python is a general-purpose programming language known for reading almost like plain English. It was created by Guido van Rossum and first released in 1991, and today it powers everything from Instagram's backend, to NASA's data pipelines, to the machine-learning models behind ChatGPT-style tools.
Python matters to a beginner for one practical reason: the gap between "I have an idea" and "I have working code" is smaller in Python than almost any other language. There's less punctuation to memorize and less boilerplate to type, so lessons can focus on how programs think, not on satisfying a picky compiler.
You'll sometimes see references to "Python 2" in older tutorials. Python 2 reached its official end of life on
January 1, 2020, and is no longer maintained or secure to use. Every lesson on this site targets modern
Python 3 โ if you ever see code using print "text" without parentheses, you're
looking at Python 2, and you can mentally translate it to print("text").
Python is genuinely used for: web backends (Django, Flask), data analysis and visualization, automation scripts, desktop GUI apps, and the vast majority of modern AI/ML research. Its main trade-off is raw execution speed โ Python programs typically run slower than C++ or Rust โ but for most day-to-day problems, the time you save writing and debugging the code outweighs the milliseconds you lose running it.
# The interpreter reads this file top to bottom, one statement at a time
print("Hello, World!")Examples
Your first program Very Easy
print("Hello, World!")Every Python programmer's very first program. print() is a built-in function โ a reusable, named piece of behavior โ that displays whatever you put between its parentheses.
Running from the terminal Easy
# Save the file as hello.py, then in your terminal run:
# python hello.py
#
# On some systems the command is python3 instead of python
print("Running from the command line works the same way.")A .py file is just a plain text file. The python command hands that text to the Python interpreter, which reads and executes it line by line.
Checking your installed version Real World
# In a terminal (not inside Python), run:
# python --version
#
# Expected output looks like:
# Python 3.12.4
import sys
print(sys.version)sys.version asks Python itself what version is currently running your code โ useful when a tutorial behaves differently than you expect.
Visual Explanation
๐ What happens internally? (advanced)
Under the hood, Python compiles your source into bytecode and runs it on a virtual machine (the CPython interpreter). Variables are names in a namespace dictionary pointing at objects in memory โ which is exactly what the memory panel in the tracer above is showing you.
Watch the interpreter run your first line
Use the controls below to run this example one line at a time and watch the interpreter's memory update live.
Code
print("Hello, World!")
Interpreter state
Console output
Common Mistakes
Typing <code>python hello.py</code> in the wrong folder, or forgetting the <code>.py</code> extension, is the single most common beginner stumbling block.
python hello
# bash: python: command not found: hellocd path/to/your/folder
python hello.py- Keep one folder per project so your files don't get scattered across your computer.
- Name files with lowercase letters and underscores, e.g.
first_program.py, never spaces. - Run code often โ every few lines โ instead of writing 50 lines before testing anything.
- Install the official Python from python.org (or your OS package manager) rather than an unofficial source.
Exercise & Challenge
Exercise 1 โ Predict the output
print("I am learning Python.")
print("This is line two.")What will this program print, and how many lines of output will there be?
๐ Challenge
Write a short program that prints your name, your favorite hobby, and one goal you have for learning Python โ three separate print() calls.
- Use exactly three print() calls
- Each should print a complete sentence
- Save it as about_me.py and run it from your terminal
๐ก Need a hint?
Each print() call needs its own line and its own set of parentheses.
๐ Show a sample solution
print("My name is Asha.")
print("My favorite hobby is chess.")
print("My goal is to build my own app.")Quiz
Answer every question, then submit to see your score and explanations.
1. What replaced Python 2, and when did Python 2 officially stop being maintained?
2. What does the Python interpreter do?
3. Which command typically runs a file named app.py from a terminal?
4. Why is Python popular for beginners?
5. What file extension do Python source files use?
Summary
- Python is a beginner-friendly, general-purpose language used across web, data, automation, and AI.
- Always use Python 3 โ Python 2 is retired and unsupported.
- A .py file is plain text; the interpreter runs it top to bottom.
- You can run files from a terminal with
python filename.py.