University of Toronto · FACULTY OF COMPUTER SCIENCE

CSC108H1 Introduction to Computer Programming

- one subject, every graph, every model, every mark
10 Chapters44-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
The Complete Exam Bible · Fall 2026

CSC108H1 Overview

Introduction to Computer Programming
— Trace it on paper, then write it in Python.
  • Fall 2026
  • First-year course
  • Python with Wing 101
  • Paper tests with no aids
  • Three-hour final exam

A first programming course in Python

Introduction to Computer Programming is the University of Toronto's first course in Python for students who have never programmed. The opening lecture says most students in it do not plan to enrol in a computer science program, and that the teaching team assumes no prior experience.

  • Assessed by Weekly Prepare and Perform exercises, four assignments, two quizzes, a midterm test and a final exam on which you must earn 40% to pass the course.
  • Hardest step Tracing code on paper with no aids: drawing the memory model, following each function call and stepping through loops one pass at a time.
  • How to prepare Do every worksheet question by hand before checking it in Python, and work through each week in order, since every topic builds on the last.
CSC108H1 · University of Toronto
An independent, AskSia-authored study guide. AskSia is not affiliated with, endorsed by, or sponsored by University of Toronto; the course code and name are used for identification only.
Assessment

How CSC108H1 is assessed

ComponentWeightFormat
Final Exam · hurdle40%On paper, 3 hours, in the final assessment period; you must earn 40% on it to pass the course
Midterm Test20%90 minutes on paper, outside lecture time, no aids
Quizzes (2)12%6% each, 30 minutes on paper in your lecture section, no aids
Assignments (4)12%3% each, submitted on MarkUs, due Tuesdays before 4:00 pm
Perform Exercises10%Weeks 2 to 12; the best 9 of 11 weekly marks count equally
Prepare Exercises5%Weeks 2 to 12; the best 9 of 11 weekly marks count equally
Surveys1%Two surveys, 0.5% each

The seven components in the opening lecture's coursework table total 100%. Passing the course requires a mark of at least 40% on the final exam. Prepare and Perform exercises allow unlimited attempts, mark the last attempt before the due date, count the best 9 of 11 weeks and accept no late submissions. Assignments have a one-hour grace period, and for each one an extension of as much as 4 days can be requested. The final exam is scheduled by Arts & Science in the final exam period, and the course said more information about it would be posted later in the term.

Assessment structure

40%Final Exam20%Midterm Test12%Quizzes12%Assignments10%Perform 10%, Prepare 5%, Surveys 1%

Segment widths reproduce the published weights and total 100%.

Current dates · verify in LMS

Current CSC108H1 dates

DateItemControl
September 29, 2026Assignment 1 dueBefore 4:00 p.m., submitted on MarkUs.
October 5-6, 2026Quiz 1Monday for Monday and Wednesday sections, Tuesday for Tuesday and Thursday sections, in your usual lecture.
October 13, 2026Assignment 2 dueBefore 4:00 p.m., submitted on MarkUs.
November 17, 2026Week 11 Prepare exerciseDue by 9 a.m., moved from the usual Monday noon deadline.

Dates are as published in the Fall 2026 assignment pages, the Quiz 1 announcement and course announcements. Confirm exact deadlines and submission settings in the live LMS.

Contents · every chapter, one map

What CSC108H1 covers

Ten chapters follow the lecture worksheets for Weeks 1 to 5, from expressions and the memory model through functions, if statements and strings to loops and lists.

01

Expressions, Types and Built-in Functions

Operators and precedence, int and float, three kinds of division, error messages, and calls to max, min, abs, pow, round, type and help

What Week 1 starts with

The course opens in the Python shell and treats it as a calculator. An expression is code that produces one value, and every value has a type: int for whole numbers, float for numbers with a fractional part.

  • Expressions, values and the shell prompt
  • The int and float types and the type function
  • Operator precedence from parentheses to addition
  • True division, integer division and modulo
  • Syntax errors, semantic errors and tracebacks
  • Built-in functions, optional arguments and nested calls
02

Variables, Assignment and the Memory Model

Naming rules, assignment as evaluate then store, memory addresses and diagrams, reassignment and the safe swap

The model behind every trace

A variable stores the memory address of a value, not the value itself, and an assignment statement runs right side first: evaluate the expression, then store the address of its value.

  • Variable naming rules and pothole_case
  • Assignment as evaluate then store
  • Memory addresses and the id function
  • Drawing a memory model diagram
  • Reassignment and why variables are not linked
  • Swapping two values with a temporary variable
03

Defining and Calling Your Own Functions

Headers and bodies, parameters and arguments, the rules for executing a call, return versus None, and helper functions

From built-in to your own

Week 2 moves from calling functions to writing them. A definition has a header, made of def, a name, parameters in parentheses and a colon, and an indented body that returns a value.

  • Function headers, bodies and indentation
  • Parameters in the definition and arguments in the call
  • The four rules for executing a call
  • Return statements and the value None
  • Helper functions and function reuse
  • Writing functions in a file and calling them in the shell
04

The Function Design Recipe and Testing

Examples, header, description, body and test, type contracts, preconditions, description rules and testing in the shell

Five steps in a fixed order

The Function Design Recipe asks for examples first, then the header with its type contract, then a description, then the body, and finally a test of every example in the shell.

  • The five steps of the Function Design Recipe
  • Writing docstring examples before code
  • Type contracts in the function header
  • Rules for a strong docstring description
  • Preconditions and who must meet them
  • Testing examples and corner cases in the shell
05

Booleans, Comparisons and Logical Operators

True and False, comparison operators, and, or and not, precedence, short-circuit evaluation, string comparison and the in operator

A type with two values

Week 3 introduces bool, whose only values are True and False. Comparison operators produce bools, and arithmetic happens before comparison.

  • The bool type and its two values
  • Comparison operators and arithmetic order
  • Truth tables for not, and and or
  • Precedence among logical operators
  • Short-circuit evaluation and guards
  • Comparing strings and the in operator
06

If Statements and Choosing Docstring Examples

if, elif and else as one structure, separate ifs versus elif, condition order, boundary examples and constants

One structure, one branch

An if statement starts with one if, may continue with any number of elif clauses and may end with one else.

  • The shape of if, elif and else
  • How Python chooses exactly one branch
  • Separate if statements versus elif
  • Ordering conditions from narrow to broad
  • Choosing docstring examples by behaviour
  • Boundary examples and named constants
07

Strings: Indexing, Slicing and Methods

Concatenation and repetition, len, positive and negative indices, slices and strides, string methods and the help sheet

Text as a sequence

A string is a sequence of characters. Each character has an index counted from 0 on the left and from -1 on the right, and a slice collects the characters from one index onward, stopping just before a second index.

  • Quotes, the empty string and len
  • Concatenation, repetition and conversion
  • Positive and negative indices
  • Slices, omitted ends and strides
  • String methods return new strings
  • Reading help entries for find, count and strip
08

For Loops and the Accumulator Pattern

Loop bodies and passes, counting, totalling and building strings, any and every checks, and early return

Repeating with a for loop

A for loop executes its body one time per element of a sequence, and on each pass the loop variable refers to the next element.

  • Loop bodies, passes and the loop variable
  • The three steps of the accumulator pattern
  • Counting and totalling characters
  • Building a new string from an empty one
  • Any and every questions with a Boolean flag
  • Searching with an early return
09

While Loops and Index-Based Search

Loop conditions and progress, stop and go conditions, guarded index searches and tracing loops by hand

Repeating while a condition holds

A while loop checks its condition at the start of every pass and repeats its body while the condition is True. Something in the body must move the loop toward stopping, or it runs forever.

  • The while condition and when it is checked
  • Progress lines and infinite loops
  • Stop conditions and their negation
  • Guarded searches over string indices
  • Trace tables for loop variables
  • Debugging loops in Wing 101
10

Lists, List Methods and Aliasing

Indexing lists, modifying versus reassigning, aliasing, sort returning None, range with start, stop and step, and loops over lists

Values that can change

Lists store several values in one sequence, index and slice like strings, and can be modified after they are created.

  • Indexing, length and membership in lists
  • Modifying a list versus reassigning a name
  • Aliasing and shared addresses
  • Methods that modify and return None
  • The range function with start, stop and step
  • Building new lists and modifying in place

Its weekly cycle pairs online Prepare videos and exercises with lectures built around worksheets and online Perform exercises, while four assignments ask students to plan, implement and test functions in Wing 101.

What the first five weeks cover

Week 1 treats Python as a calculator: expressions, the int and float types, the three division operators, built-in functions and the memory model of variables and assignment.

Week 2 defines functions, introduces the Function Design Recipe and tests functions against their docstring examples. Week 3 adds Booleans, if statements, choosing docstring examples and string operations. Week 4 covers string methods, for loops with the accumulator pattern, debugging in Wing 101 and while loops.

Week 5 introduces lists, list methods, aliasing and the range function.

How the course is assessed

The final exam carries the largest single weight and is written on paper over three hours, and students must reach the published minimum on it to pass the course. A midterm test and two short quizzes are also written on paper with no aids.

Weekly exercises, four assignments and two short surveys make up the rest of the mark.

How this guide is built

Ten chapters follow the lecture worksheets for Weeks 1 to 5. Each explains the idea, traces an original example by hand and ends with practice in the forms the worksheets and assignments use. All examples are written by AskSia; they are study aids, not course materials.

Worked example · free

Trace a digit total through a for loop

Q [4 marks]. AskSia-authored practice. A function sets total to 0, loops over each character ch of '4x7y2', and adds int(ch) to total whenever ch.isdigit() is True. Trace total after every pass and give the returned value. The marks shown are an AskSia study allocation, not an official University marking scheme.
Figure 8.1.Figure 8.1. Each bar is the value of total after one pass of a loop that adds every digit in the string 4x7y2. Dark bars mark passes where the character was a digit and the total grew; on the pale passes for x and y nothing changed, and the final bar shows the int 13.4'4'4'x'11'7'11'y'13'2'character examined on each passtotal
Figure 8.1. Each bar is the value of total after one pass of a loop that adds every digit in the string 4x7y2. Dark bars mark passes where the character was a digit and the total grew; on the pale passes for x and y nothing changed, and the final bar shows the int 13.
  • 1Start the accumulator before the loop: total refers to 0.
  • 2Pass by pass: '4' gives 4, 'x' leaves 4, '7' gives 11 and 'y' leaves 11.
  • 1The last pass adds 2, so total is 13 and the function returns it.
total takes the values 4, 4, 11, 11 and 13 across the five passes. Only digit characters change it, the letters leave it as it is, and the function returns the int 13 once the loop has examined every character.
Sia tip — Write int(ch), not ch: adding the character '4' to an int total raises a TypeError on the very first digit.
Glossary

Key terms

Expression
Code that Python evaluates to produce a single value of one type.
Memory Model
A diagram showing variables on one side and the values their stored addresses lead to on the other.
Memory Address
The location where a value is stored, written as id1, id2 and so on in course diagrams.
Type Contract
The parameter types and return type written in a function header.
Function Design Recipe
A five-step method for writing a function: examples, header, description, body and test.
Docstring
The triple-quoted text under a function header that describes the function and shows example calls.
Precondition
A requirement on a function's inputs, stated in its docstring, that callers are responsible for meeting.
Helper Function
A function that another function calls to do part of its work.
Short-Circuit Evaluation
Stopping an and or or expression as soon as its result is known, so the right side may never run.
Index
The position of an element in a string or list, counted from 0 on the left or -1 on the right.
Slice
A piece of a string or list that begins at one index and stops just before a second one.
Method
A type's own function, invoked by writing a value, a dot and the method name.
Accumulator Pattern
A loop technique that initialises a variable, updates it on relevant passes and returns it at the end.
Alias
A variable that holds the same list address as another variable, so changes through one appear through both.
FAQ

CSC108H1 FAQ

How is the Toronto introductory Python course graded?

According to the opening lecture's coursework table, the final exam is worth 40%, the midterm test 20%, two quizzes 12% together, four assignments 12% together, Perform exercises 10%, Prepare exercises 5% and two surveys 1%. Prepare and Perform marks count the best 9 of 11 weeks.

What is the final exam like?

It is written on paper and lasts three hours, and Arts & Science schedules it during the final exam period. The slides state that you must earn 40% on it to pass the course, and the course said fuller details would be posted later in the term, so watch the course page.

Do I need programming experience before starting?

No. The opening lecture says the teaching team assumes students have never programmed, and that most people taking the course do not plan to enrol in a computer science program. Students come from programs such as economics, psychology and music, and many are still undecided.

Can I use notes or a computer on the quizzes and midterm?

No. The course states that its tests are paper-based and allow no aids, and Quiz 1 was closed book with no computers or calculators. Instead, the course supplied help entries for the functions and methods students might need, posted in advance for study.

What is the Function Design Recipe?

It is the five-step process the course uses to write every function: write examples, then the header with its type contract, then a description, then the body, and finally test each example in the shell. Assignments ask you to follow it and mark both style and correctness.

Why do memory model diagrams matter so much?

They are how the course explains what variables, function calls and lists really do, and they appear in assessments: Assignment 1 and Assignment 2 each included tasks asking for code that produces a given memory model diagram. Aliasing questions about lists are almost impossible without them.

What does the course say about using generative AI?

The opening slides warn that students who hand their exercises and assignments over to other people or tools tend to fail, because their supervised quiz, test and exam marks fall short. They add that such tools can create a false sense of mastery that disappears on paper.

Chapter questions

Questions students ask in each CSC108H1 chapter

Why does 8 / 4 give 2.0 rather than 2?
True division with / always produces a float in Python, even when the division is exact. Use // when you want the whole-number result as an int, and remember that a tracing question treats 2 and 2.0 as different answers. Chapter 01 · Expressions, Types and Built-in Functions
Why does the course say a variable refers to a value?
Because the variable holds the address where the value is stored, not the value itself. Two variables can hold the same address, and reassigning one gives it a new address without disturbing the other, which is exactly what memory model questions test. Chapter 02 · Variables, Assignment and the Memory Model
What is the difference between a parameter and an argument?
A parameter is a name in the function header, such as bill in total_due(bill, rate). An argument is the value written in a particular call, such as 40.0. During the call the parameter holds the address of the argument's value. Chapter 03 · Defining and Calling Your Own Functions
What order do the Function Design Recipe steps go in?
Examples, header, description, body and test. Writing examples first fixes what the function should return before you think about code, and the final step runs those same examples in the shell to check the body against them. Chapter 04 · The Function Design Recipe and Testing
What is the difference between = and ==?
One equals sign assigns: it stores an address in a variable and produces no value. Two equals signs ask whether two values are equal and produce True or False. Writing if x = 5: is a syntax error in Python. Chapter 05 · Booleans, Comparisons and Logical Operators
What is the difference between elif and a second if?
An elif belongs to the same structure and is skipped once an earlier branch has run. A separate if begins a new structure and is always tested, so it can run as well if an earlier branch changed the variable it checks. Chapter 06 · If Statements and Choosing Docstring Examples
Why does s[len(s)] raise an error?
Indices start at 0, so the last character of s is at len(s) - 1. Asking for position len(s) points one past the end, where no character exists, and Python raises an IndexError. Slices are more forgiving, but single indices are not. Chapter 07 · Strings: Indexing, Slicing and Methods
What starting value should an accumulator have?
It depends on the answer you are building: 0 for a count or a total, the empty string for new text, False when asking whether any character qualifies and True when asking whether every character does. The course reference sheet lists these choices. Chapter 08 · For Loops and the Accumulator Pattern
When should I use a while loop instead of a for loop?
When you do not know in advance how many passes you need, or when you want to stop as soon as a condition is met, such as finding the first space in a string. A for loop always visits every element. Chapter 09 · While Loops and Index-Based Search
Why does changing one list variable change another?
If one variable was assigned from the other, both hold the address of the same list, so they are aliases. Any modification through either name, such as append or assignment to an index, changes the one shared list. Chapter 10 · Lists, List Methods and Aliasing
Study strategy

How to study for the exam

Work in three passes. First, for each week, redo every lecture worksheet question on paper, then check it in Python or the visualizer; the course's own advice for Quiz 1 was to look at posted solutions only at the end. Second, build a personal trace bank: one memory model, one function call, one if chain, one for loop and one while loop per week, each traced line by line with a table of variable values.

Third, rehearse writing functions with the Function Design Recipe under a time limit, examples before code, and test every example plus one corner case. Throughout, keep the help-sheet habit: answer string and list questions with only the help entries beside you, as on the quizzes and midterm. Do not skip a week, because each topic is used by the next.

Study CSC108H1 with AI

Your AI Computer Science tutor for CSC108H1

Stuck on a hard CSC108H1 question? Sia is AskSia’s AI Computer Science tutor — ask any CSC108H1 Introduction to Computer Programming question and get a clear, step-by-step explanation grounded in how the course is actually taught and assessed. Read this whole study guide free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 21 of your University of Toronto subjects - and 1,000+ Bibles across every Australian university.
Sia - your CSC108H1 tutor, unlimited, worked the way the exam marks it
The full 44-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works