
Getting Started with Python: A Gentle, Practical Introduction
This course guides you from zero programming experience to writing your own small Python programs using the latest Python 3 releases. You will install Python, practice core syntax with hands-on examples, and build confidence solving simple real-world problems.
Course Content
11 modules · 2h 30m total
Welcome to Python: Why This Language and How to Start
Step into the world of Python and see why it remains one of the most popular first programming languages in 2026, powering everything from tiny scripts to AI systems. You’ll get a clear picture of what you can realistically achieve in your first weeks and how this course will guide you there without overwhelm.
Setting Up Python and Your First Lines of Code
Watch your computer turn into a coding playground as you install Python and run your very first commands. In just a few minutes, you’ll go from no setup at all to printing your first message and doing quick calculations in Python.
Speaking Python: Variables, Data Types, and Basic Operations
Move beyond one-off commands and start teaching Python to remember things and do useful work. You’ll see how variables, numbers, and text fit together so you can write small snippets that already feel like real programs.
Collections of Data: Lists, Tuples, and Dictionaries
Instead of juggling single values, discover how to organize groups of items—like shopping lists, scores, or user records—so Python can manage them effortlessly. You’ll learn the building blocks that power almost every real-world Python program.
Making Decisions: Conditions and Branching Logic
Turn your programs from passive calculators into decision-makers that behave differently depending on the situation. With conditions, your code can react to user input, compare values, and choose the right path automatically.
Doing Things Repeatedly: Loops and Iteration
Stop copying and pasting code and let Python handle repetition for you. You’ll harness the power of loops to process lists, repeat actions, and build programs that scale from a few items to hundreds with almost no extra effort.
Packaging Logic: Functions and Reusable Code
As your programs grow, repeating the same logic becomes messy and error-prone. Functions let you name chunks of work, reuse them anywhere, and write cleaner, more professional-looking code from the very beginning.
Talking to the Outside World: Input, Output, and Files
Transform your scripts from silent number crunchers into interactive tools that ask questions, display results clearly, and even remember information between runs by saving it to files.
Using Python’s Built-in Superpowers: Modules and the Standard Library
Instead of reinventing the wheel, tap into Python’s huge toolbox of ready-made features for random numbers, dates, math, and more. You’ll discover how a single import can unlock powerful capabilities in just a few lines of code.
Finding and Fixing Problems: Errors, Debugging, and Good Habits
Every programmer, beginner or expert, runs into errors—what matters is how quickly you can understand and fix them. You’ll learn to read Python’s error messages, avoid common pitfalls, and adopt simple habits that make your code more reliable.
Your First Mini Project: A Simple Interactive Python App
Bring everything together by building a small but complete Python program—from idea to working code you can actually use. You’ll see how all the pieces you’ve learned fit together into something you can show others with pride.
Read the Textbook
Read every chapter for free, right here in your browser.
Python is one of the most popular first programming languages in 2026. It is used by beginners, professional developers, scientists, and AI researchers.
In this short module, you will: See what Python is and what people use it for today Learn why we use Python 3 (and not Python 2 anymore) Get a simple picture of how Python runs your code Discover easy ways to start writing and running Python, both on your own computer and online
By the end, you should be able to explain Python in your own words and feel confident about where to start.
Study Flashcards
Key concepts from this course as flashcard pairs.
Welcome to Python: Why This Language and How to Start
Python (as a language)
A programming language used to give instructions to computers. Known for being readable, beginner-friendly, and powerful.
Python 3
The current standard version of Python. Actively maintained and recommended for all new projects and for learning.
Python 2 end-of-life
Python 2 stopped receiving updates in January 2020. New learners should not use it and should choose Python 3 instead.
Interpreter
A program that reads your Python code line by line, translates it into lower-level operations, and executes it.
Script mode
Running Python code saved in a .py file, for example using a command like `python my_script.py`.
Interactive mode
Typing Python commands one line at a time (for example in a Python shell or notebook) and seeing results immediately.
+2 more flashcards
Setting Up Python and Your First Lines of Code
Python REPL
The interactive Python shell where you type commands at `>>>` and see results immediately. REPL stands for Read–Evaluate–Print Loop.
Script file
A saved text file ending in `.py` that contains Python code. You run the whole file at once using Python.
Official Python download site
The safe, up-to-date place to get Python: `https://www.python.org`. Avoid random download sites.
PATH (on Windows)
A system setting that lets you run `python` from any Command Prompt. Checking 'Add python.exe to PATH' during install sets this up.
Interactive mode vs script
Interactive mode is like a scratchpad for quick tests. A script is a saved program you can run again and share.
Speaking Python: Variables, Data Types, and Basic Operations
Variable
A named storage location in memory that holds a value, like `age = 15`. You can use the name later to access or change the value.
Assignment
The act of giving a value to a variable using `=`, for example `score = 10`.
int
Integer type in Python: whole numbers without a decimal point, such as `-3`, `0`, `42`.
float
Floating-point type in Python: numbers with a decimal point, such as `3.14`, `0.5`, `-2.0`.
str (string)
Text data type in Python, written inside quotes, for example `"Hello"` or `'Python'`.
bool (boolean)
Logical data type with only two values: `True` or `False`.
+4 more flashcards
Collections of Data: Lists, Tuples, and Dictionaries
List
An ordered, mutable collection of items written with square brackets [], like [1, 2, 3]. You can change, add, and remove items.
Tuple
An ordered, immutable collection of items written with parentheses (), like (1, 2, 3). Once created, it cannot be changed.
Dictionary
A collection of key–value pairs written with curly braces {}, like {"name": "Aisha", "age": 15}. You access values by key, not by index.
Index
The position of an item in a list or tuple. The first item has index 0. Negative indexes like -1 start from the end.
append()
A list method that adds a new item to the end of a list, for example: my_list.append("new").
insert()
A list method that adds a new item at a specific position: my_list.insert(index, item). Existing items move to the right.
+2 more flashcards
Making Decisions: Conditions and Branching Logic
Condition
An expression that can be either True or False, such as `age >= 18` or `password == "abc"`.
If statement
A structure that runs a block of code only if its condition is True.
Elif
Short for else if. Used after an if to check another condition if previous ones were False.
Else
The block that runs if all previous if/elif conditions in the chain are False.
Indentation
Spaces at the start of a line that show which lines belong to a block, such as inside an if statement.
Comparison operators
Operators like `==`, `!=`, `<`, `>`, `<=`, `>=` that compare values and return True or False.
+1 more flashcards
Doing Things Repeatedly: Loops and Iteration
for loop
A loop that goes through each item in a sequence (like a range, list, or string) and runs the loop body once for each item.
while loop
A loop that repeats as long as its condition is true. Good when you do not know in advance how many times you will loop.
range(start, stop, step)
A function that produces a sequence of numbers for looping. Commonly used as range(start, stop). The sequence includes start but stops before stop.
break
A statement that immediately ends the nearest loop and jumps to the code after the loop.
continue
A statement that skips the rest of the current loop body and moves on to the next repetition of the loop.
Looping over a dictionary
Use `for key in d`, `for value in d.values()`, or `for key, value in d.items()` to process the keys and values in a dictionary.
+1 more flashcards
Packaging Logic: Functions and Reusable Code
Function
A named block of code that does one job. You define it once with `def` and call it whenever you need that job done.
Function definition
The part of the code where you create a function, starting with `def name():` and followed by an indented body.
Function call
Using a function by writing its name followed by parentheses, for example `greet("Mia")`.
Parameter
A variable name in the function definition that receives a value when the function is called.
Argument
The actual value you pass into a function when you call it, for example `"Mia"` in `greet("Mia")`.
Return value
The result that a function sends back using `return`. You can store it in a variable or use it in expressions.
+3 more flashcards
Talking to the Outside World: Input, Output, and Files
input()
A function that pauses the program, shows a prompt, and returns what the user types as a string. You usually convert it to int or float for numbers.
print()
A function that sends information to the screen. Often used with f-strings to mix text and variable values in a clear way.
f-string
A string that starts with f and allows `{}` placeholders for expressions, for example: `f"Total: {total:.2f}"`.
with open(...) as f:
The safest pattern for working with files. It opens a file, gives you a file object `f`, and automatically closes the file when the block ends.
File modes: "r", "w", "a"
"r" = read, "w" = write (create/overwrite), "a" = append (add to the end). Used as the second argument to `open()`.
encoding="utf-8"
Tells Python to read or write text using UTF-8, the standard encoding on modern systems. Helps avoid weird character errors.
+1 more flashcards
Using Python’s Built-in Superpowers: Modules and the Standard Library
Module
A Python file that contains code (functions, classes, variables) that you can import and reuse in other programs.
Standard library
The collection of modules that comes built into Python (such as math, random, datetime, pathlib). You do not need pip to use them.
import module
An import style that brings in the whole module, so you use names with a prefix, like math.sqrt or random.randint.
from module import name
An import style that brings specific names from a module so you can use them directly, like from math import sqrt, pi.
pip
Python’s package manager. It installs third-party packages from the Python Package Index (PyPI) so you can import them.
pathlib
A standard library module for working with file and folder paths in a clean, cross-platform way using Path objects.
Finding and Fixing Problems: Errors, Debugging, and Good Habits
Syntax error
An error where Python cannot read the code at all because the "grammar" is wrong. Detected before the program starts running, usually shown as SyntaxError.
Runtime error (exception)
An error that happens while the program is running, even though the code is valid Python. Examples: ZeroDivisionError, ValueError, NameError.
Traceback
Python’s error report. It shows the file and line number where the error happened, the code line, and the error type with a short message.
Debugging
The process of finding and fixing problems (bugs) in your code. Often involves reading tracebacks, using print statements, and testing small pieces of code.
Print debugging
A simple debugging method where you add print statements to show variable values and program flow, helping you see what is really happening.
try/except block
Python structure used to handle expected errors. Code that might fail goes in try; the except block defines what to do if a specific error type occurs.
+1 more flashcards
Your First Mini Project: A Simple Interactive Python App
Breaking a problem into steps
Write out what your program should do in simple, human steps (like a recipe) before coding. Then match each step to Python tools such as input, loops, and conditionals.
Input / Processing / Output
Input: data from the user (with `input()`). Processing: calculations and decisions (variables, loops, `if`). Output: information shown to the user (with `print()`).
Function
A named block of code that does a specific job. Example: `def play_game():` defines a function you can call whenever you want to run the game.
Module
A separate file or built-in library with extra code you can reuse. You bring it in with `import`. Example: `import random` lets you use `random.randint()`.
Debugging
The process of finding and fixing errors in your code. Common tools: reading error messages, adding temporary `print()` statements, and testing edge cases.
Loop with `else`
In Python, a `for` or `while` loop can have an `else` block. The `else` runs only if the loop finishes normally (no `break`). In the game, it runs when the player uses all attempts.