Exam prep · Free college course
A complete first computer science course taught in Python, built from the 14 chapters of OpenStax Introduction to Python Programming plus a searching, sorting and Big-O unit and a testing and debugging unit. It runs from statements, expressions and types through decisions, loops, functions and scope, modules, strings, lists, and dictionaries, sets and tuples, then classes, recursion, inheritance, files and exceptions. Each chapter starts with a short notes card and then mixes recall, multiple choice, cloze, typed answers, true or false, and a few sequence cards. Many cards show a short snippet and ask what it prints or which exception it raises, and the classic beginner traps are seeded throughout: integer versus float division, aliasing, the mutable default argument, scope shadowing, off-by-one errors, and == versus is. Every snippet was run in real Python 3 before it went into a card. One honest limit: cards cannot run code. This course is the concept half of CS1, terminology, tracing and prediction, so use it alongside an editor or IDE, not instead of one. It does not ask you to write programs.
Copied straight from the course. Pick an answer to see if you were right, and why.
Card 1 of 15Which list can binary search be used on correctly?
A list already sorted in ascending order. Binary search relies on order to decide which half can be thrown away, so its input must already be sorted.
Card 2 of 15Which lists the logical operators from highest precedence to lowest?
not, and, or. not binds tightest, then and, then or, all looser than the comparison operators.
Card 3 of 15On [2, 5, 8, 12, 16, 23, 38, 56, 72, 91], searching for 2 (the first item), which search makes fewer comparisons?
Linear search, with 1 comparison against 3 for binary. Best case for linear search is the first item (1 comparison). Binary search still has to narrow down to it (3 comparisons on this list).
Card 4 of 15In the statement x = 5, which part is an expression?
The literal 5. An expression represents a single value to be computed. In x = 5 the literal 5 is the expression, and the whole line is the statement that stores it.
Card 5 of 15What does this program print? ```python print((1 + 3) ** 2 / 4) ```
4.0. The parentheses give 4, then 4 ** 2 is 16, then 16 / 4 is 4.0; the / operator always gives a float.
Card 6 of 15What is the output of this program? ```python a = [1, 2] b = a.copy() b.append(3) print(a, b) ```
[1, 2] [1, 2, 3]. copy() builds a new list, so appending to b leaves a untouched.
Card 7 of 15What does this program print? ```python print(bool("0"), bool(""), bool(-1)) ```
True False True. "0" is a non-empty string so True, "" is empty so False, and -1 is a non-zero number so True.
Card 8 of 15The body of a while loop always runs at least once. ```python while 3 < 2: print("never") print("done") ```
False. The condition is tested first; if it is false at the start, the body never runs.
Card 9 of 15Which line is a valid function header?
def calc_tax(rate):. A header needs def, a name without spaces, parentheses for the parameters, and a colon.
Card 10 of 15After "import math", which expression correctly calls the square-root function?
math.sqrt(25). import math binds the single name math, so its contents are reached with the dot: math.sqrt(25).
Card 11 of 15What is the result of this code? ```python s = "Cloud" print(s[5]) ```
IndexError. The string has indexes 0 to 4, so s[5] is out of range. Indexing raises IndexError, unlike slicing.
Card 12 of 15What does this print? ```python nums = [10, 20, 30, 40, 50] print(nums[1:3], nums[-2:]) ```
[20, 30] [40, 50]. A slice runs from the start index up to but not including the stop index, and -2 starts at the second-from-last element, giving [20, 30] and [40, 50].
Card 13 of 15True or false: d.get("k") raises KeyError when the key "k" is not in d.
False. get returns None (or the default you pass) for a missing key. Only the square-bracket form d["k"] raises KeyError.
Card 14 of 15Which description matches abstraction in OOP?
Hiding inner workings so users see only what they need. Abstraction shows only the necessary information, like a dashboard gauge that reports "in range" instead of the exact engine number.
Card 15 of 15What does this program print? ```python def f(n, d=1): if n == 0: print("deepest frame:", d) return f(n - 1, d + 1) f(3) ```
deepest frame: 4. f(3), f(2), f(1) and f(0) are four nested calls, so the deepest one has d = 4.
The rest are free too. Encodr schedules every review for you with spaced repetition, so you only see a card again when it is time.
Encodr is a friendly, game-like flashcard app. Spaced repetition schedules every review for you, and the rest keeps you coming back.
Study a little each day to build a streak. A streak freeze forgives a missed day.
Small goals each day, like finishing a set, with a little celebration when you clear one.
Sessions come in bite-size sets of 15 to 25 answers, so there is always a natural place to stop.
Earn XP and level up, then see friends on a daily leaderboard and send them a nudge.
Yes. Create a free Encodr account and all 16 units and 1,117 cards are yours to study, with spaced repetition scheduling your reviews.
No, and the course does not pretend to. Cards cannot run code, so it covers the concept half of CS1: vocabulary, tracing and predicting output, scope and mutability rules, naming the exception a snippet raises, and classifying Big-O. Use it next to an editor or IDE where you write and debug real programs.
OpenStax Introduction to Python Programming (chapters 1 to 14, CC BY-NC-SA 4.0), plus the Python documentation and ACM computing curricula for the searching, sorting, Big-O and testing units. The cards are rewritten, not copied.
Python 3. Every snippet was run in Python 3 before it became a card, and cards that depend on error message wording say so or ask only for the exception type.
No. Cards are text only, so call stacks and sort passes are described step by step in words.