University of Toronto - Learn to Program: The Fundamentals
Solutions for UofT’s Learn to Program: The Fundamentals
INSTRUCTORS
Instructors: Jennifer Campbell, Paul Gries
Course Description
Behind every mouse click and touch-screen tap, there is a computer program that makes things happen. This course introduces the fundamental building blocks of programming and teaches you how to write fun and useful programs using the Python language.
Syllabus
Week 1 - Python, Variables, and Functions
This module gives an overview of the course, the editor we will use to write programs, and an introduction to fundamental concepts in Python including variables, mathematical expressions, and functions.
- Pyhon and Computer Memory
- Python as a Calculator
- Variables
- Visualizing Assignment Statements
- Built-in Functions
- Defining Functions
Week 2 - Strings and Designing Functions
This module introduces strings (a Python data type used to represent text), and a process to follow when creating a function.
- Type str: Strings in Python
- Input/Output and str Formatting
- Docstrings and Function help
- Function Design Recipe
- Function Reuse
- Visualizing Function Calls
Week 3 - Booleans, Import, Namespaces, and if Statements
This module introduces Booleans (logical values True and False), how to convert between types, how to use Boolean expressions in if statements to selectively run code, and the concept of a Python module.
- Functions, Variables, and the Call Stack
- Type bool: Booleans in Python
- Converting between int, str, and float
- Import: Using Non-Builtin Functions
- The if statement
- No if Required
- Structuring if Statements
Week 4 - For Loops and Fancy String Manipulation
This module introduces one way to repeat code (using a for loop), how to manipulate strings, and how to use a debugger to watch a program execute step by step.
- More str Operators
- str: indexing and slicing
- str Methods: Functions Inside Objects
- for loop over str
- IDLE’s Debugger
Week 5 - While Loops, Lists, and Mutability
This module introduces another way to repeat code (using a while loop), how to properly document your code to help other programmers understand it, Python’s list data type, and the concept of mutation.
Week 6 - For Loops Over Indices, Parallel and Nested Lists and Strings, and Files
This module introduces how to use a for loop over the indexes of a list, how to nest lists, and how to read a write files.
- for loops over indices
- Parallel Lists and Strings
- Nested Lists
- Nested Loops
- Reading Files
- Writing Files
Week 7 - Tuples and Dictionaries
This module introduces tuples (an immutable version of lists), and Python’s dictionary type.