Practice Exercises
Hands-on programming exercises to master each skill. Each exercise includes problem descriptions, templates, test cases, and solutions.
Exercise 1: Basic Function Design (Pyret)
Practice designing functions with proper type annotations, docstrings, and test cases. Covers temperature conversion, string manipulation, and arithmetic operations.
Exercise 2: Construct & Transform Tables (Pyret)
Work with tables: creating them, filtering rows, building columns, and transforming data. Practice with student grades and restaurant data.
Exercise 3: Iteration: Lists (Pyret)
Practice list iteration using for-each loops and mutable variables. Build functions that process lists element by element.
Exercise 4: Structured & Conditional Data (Pyret)
Define and use data types with multiple variants. Practice with cases expressions and conditional logic.
Exercise 5: Recursion: Lists (Pyret)
Implement recursive functions over lists. Master the base case and recursive case pattern.
Exercise 6: Recursion: Trees (Pyret)
Work with tree structures and implement recursive tree traversal algorithms.
Exercise 7: Variable Scope (Pyret & Python)
Understand Python's variable scoping rules, global vs local variables, and the global keyword.
Exercise 8: Design Basic Functions (Python)
Design Python functions with type hints, docstrings, and proper testing practices.
Exercise 9: Iteration: Lists (Python)
Master Python's for loops, list comprehensions, and iteration patterns.
Exercise 10: Aliasing & Mutation (Python)
Understand Python's object references, aliasing effects, and how mutation works with shared data.