🐍 Programming I with Python
Write your first real programs in Python. You'll understand variables, loops, and functions and be able to build small scripts that solve everyday problems.
What you’ll learn
- What a Program IsDefine what a program is and run a first line of Python.A program is a precise instruction sequence, an idea older than electronics — Jacquard's 1804 loom read its patterns from punched cards. Python (Guido van Rossum, 1991) is an interpreted language built for readability, and your first program is one print() call.
- Variables: Naming Your DataUse assignment to name, read, and update values.Variables attach names to values; = is a command, not an equation, and y = x copies the current value rather than creating a link. Clear names are the cheapest documentation a program can have.
- Strings: Working with TextManipulate text with indexing, slicing, and string methods.Strings are zero-indexed character sequences supporting len, slices, and methods like .upper(), .strip(), and .split() — which return new strings rather than changing the original. Text processing has been central to computing since the 80-column punch-card era.
- Numbers and ArithmeticCompute with ints and floats and command the three division operators.Python separates whole numbers from decimals and offers / (true division), // (floor), and % (remainder) — the last unlocking even/odd tests and cyclic problems. Babbage's 1820s Difference Engine shows mechanical arithmetic as the computer's direct ancestor.
- Input and OutputBuild interactive programs with input(), print(), and f-strings.input() returns strings (convert with int/float), and f-strings evaluate expressions inside braces for clean output. Grace Hopper's early-1950s compiler work began the tradition of languages that read like human notation.
- Making Decisions with ifBranch programs with if/elif/else and boolean logic.Conditions evaluate to True or False, and the first matching branch (only) runs, with indentation carrying the structure. Comparisons (==, >=) and combinators (and, or, not) compose small yes/no questions into real decision logic.
- Repetition I: while LoopsWrite while loops that provably terminate.A while loop repeats as long as its condition holds, so something in the body must drive the condition false — the classic beginner bug is computing a new value without storing it. Repetition at scale is precisely what computers are built for.
- Repetition II: for LoopsIterate collections and numeric ranges with for.for visits each item of a collection once, with range(start, stop, step) generating number sequences that exclude their stop value. Punch-card batch processing was a for loop in physical form: one card per pass, top of the deck to the bottom.
- Lists: Ordered CollectionsStore, index, slice, and mutate ordered collections.Lists hold ordered, changeable sequences: append and sort mutate in place (returning None), while sorted() and slices return new lists — a distinction behind many beginner bugs. Negative indexes count from the end, and the conventions match strings exactly.
- Dictionaries: Lookup by NameMap keys to values and handle missing keys deliberately.Dictionaries answer "given X, what is Y?" with fast lookup by unique keys, where assignment adds or overwrites entries. Missing keys crash with KeyError via brackets or default gracefully via .get() — choosing which is a real design decision.
- Functions: Reusable RecipesDefine and call functions with parameters, returns, and local scope.def packages computation behind a name; calls bind arguments to parameters, run the body in a local workspace, and return a value (None if omitted). Ada Lovelace's 1843 notes described a reusable, looping procedure a century before hardware existed to run it.
- Errors and DebuggingRead tracebacks, classify common errors, and debug methodically.Tracebacks name the error type and line — NameError, TypeError, IndexError, KeyError cover most beginner crashes — and reading them is diagnosis, not punishment. From the 1947 Mark II moth to Apollo 11's 1202 alarms, software history teaches that anticipating failure is professionalism.
- Modules and the Standard LibraryImport standard-library modules and process files safely.import unlocks Python's "batteries included" toolbox — math, random, datetime, csv — and the with open(...) pattern reads files line by line while guaranteeing cleanup. Check the standard library before hand-rolling anything fiddly.
- Putting It Together: A Real ScriptAssemble variables, loops, dicts, functions, and files into a working script.The word counter — read, loop, split, tally in a dict, report — is one of programming's most reused shapes, and it is built incrementally: skeleton first, then parsing, logic, and output, each stage verified. A $35 Raspberry Pi runs it as happily as a server.
- Where to Go NextMap the road ahead: core skills, the package ecosystem, and practice habits.The constructs in this course are the permanent core of programming — the same logic the ENIAC team wired by hand in 1946. Beyond it lies the package ecosystem (pandas, NumPy, matplotlib, requests, Flask, pytest) and the one reliable path to fluency: many small, real programs.
Questions this course answers
The Jacquard loom (1804) matters to programming history because it:
Its punched cards encoded the pattern to weave — swap the cards, change the behavior. That split between hardware and instructions is the founding idea of software.
Python is called an interpreted language because:
The Python interpreter executes source code directly, which is why you can type a line and see the result immediately.
After x = 7 and then y = x and then x = 2, the value of y is:
Assignment copies the value at that moment. y got 7; reassigning x later changes only x.
In Python, the statement total = 5 means:
A single = is assignment (a command), not a mathematical claim. Comparison uses ==.
If word = "planet", what is word[0:3]?
Slicing takes positions 0, 1, 2 — up to but not including 3: "pla".
After name = "ada" and name.upper(), the variable name contains:
String methods return NEW strings; they never change the original. To keep the result you'd write name = name.upper().
Grounded in trusted sources
- Python Software Foundation — official Python tutorial and documentation (docs.python.org)
- Allen Downey, Think Python: How to Think Like a Computer Scientist (2nd ed., O'Reilly, 2015)
- L.F. Menabrea, Sketch of the Analytical Engine, with notes by Ada Lovelace (1843)
- Smithsonian National Museum of American History — Harvard Mark II log book (1947)
- NASA — Apollo Guidance Computer and the 1202 alarm records
- Computer History Museum — punched cards, ENIAC, and Grace Hopper collections
- Science Museum London — Babbage Difference Engine No. 2
- Raspberry Pi Foundation — hardware documentation
Every Wunder lesson is built from real, reputable sources — never invented.
Related Science courses
Wunder is a personalized learn-anything platform — tell it any topic and it builds a beautiful, fact-checked course in minutes, with narration, a knowledge check, and a college-style University track.
Browse more Science courses · All topics · Home
© 2026 Wunder Learning LLC · Terms & Privacy