W WolfCode · CSC 141

Fall 2026 · Wolfcode

Computer Science I.

An introduction to programming using Python.

Topics covered include basic program design; program flow including decisions, functions, and loops; command-line and file input/output; variables and types; and string and sequence processing.

Examples on this site run in your browser — no install. Open the matching exercise in WolfCode to submit.

Course outline

Chapter 01

Variables & Types

变量与类型

≈ 75 min · 3 lessons

Name a value once, reuse it many times. Learn the three core types of CSC 141 — int, float, str — and how Python keeps them straight.

  1. 01.01
    Your First Variable
    第一个变量
    python-variables 10m
  2. 01.02
    Integers & Floats
    整数与浮点数
    python-types 15m
  3. 01.03
    Strings & f-strings
    字符串与 f-string
    python-strings 20m
Chapter 02

Conditionals

条件分支

≈ 90 min · 5 lessons

Make decisions: if / elif / else, comparison and logical operators, and the order-of-branches trap. Strictly aligned with Think Python §5.1–§5.6.

  1. 02.01
    Walkthrough: Sign of a Number
    例题: 数的正负号
    python-conditionals 8m
  2. 02.02
    Letter Grade
    等级字母
    python-conditionals 15m
  3. 02.03
    BMI Category
    体重指数分类
    python-conditionals 15m
  4. 02.04
    Leap Year
    闰年判断
    python-conditionals 15m
  5. 02.05
    Homework: Tax Bracket Calculator
    作业: 阶梯税率计算器
    python-conditionals 35m
Chapter 03

Loops

循环

≈ 100 min · 5 lessons

Do something many times. for / range, while, break — and the four patterns (accumulator, counter, tracking variable, while-true) that cover 95% of beginner loops. Strictly aligned with Think Python §7.1–§7.4.

  1. 03.01
    Walkthrough: Countdown
    例题: 倒计时
    python-loops 8m
  2. 03.02
    Sum 1..n
    1 到 n 求和
    python-loops 15m
  3. 03.03
    FizzBuzz
    FizzBuzz
    python-loops python-conditionals 20m
  4. 03.04
    Find the Max
    找最大值
    python-loops 15m
  5. 03.05
    Homework: Collatz Steps
    作业: Collatz 步数
    python-loops python-conditionals 30m
Chapter 04

Functions

函数

≈ 105 min · 5 lessons

Name a group of statements, eliminate repetition, debug the parts one at a time. def / return / parameters / default args / composition. Strictly aligned with Think Python §3.4–§3.11 and Chapter 6.

  1. 04.01
    Walkthrough: Square & Cube
    例题: 平方和立方
    python-functions 8m
  2. 04.02
    Clamp
    限制范围
    python-functions python-conditionals 15m
  3. 04.03
    Multi-args Averaging
    三参数求平均
    python-functions 20m
  4. 04.04
    Default Args Greeting
    默认参数与关键字参数
    python-functions 20m
  5. 04.05
    Homework: Tip Calculator
    作业: 小费计算器
    python-functions 40m
Chapter 05

Lists

列表

≈ 110 min · 5 lessons

The universal container for sequences of values. Create, index, slice, mutate — and the copy-first idiom that saves you from aliasing bugs. List comprehensions compress map+filter into one line. Strictly aligned with Think Python §10.1–§10.12.

  1. 05.01
    Walkthrough: List Basics
    例题: 列表入门
    python-lists 8m
  2. 05.02
    List Basics
    列表入门
    python-lists python-loops 15m
  3. 05.03
    List Comprehension
    列表推导式
    python-lists python-loops 20m
  4. 05.04
    List Methods
    列表方法
    python-lists 20m
  5. 05.05
    Homework: Student Grade Report
    作业: 学生成绩报告
    python-lists python-functions python-loops 45m
Chapter 06

String Algorithms

字符串算法

≈ 110 min · 5 lessons

Treat strings as collections of characters. Index, slice, traverse, search, count. .split() / .join() / .strip() / [::-1] — the methods you reach for daily. Strictly aligned with Think Python §8.1–§8.10.

  1. 06.01
    Walkthrough: Count Vowels
    例题: 数元音字母
    python-strings python-loops 8m
  2. 06.02
    Word Count
    单词计数
    python-strings 15m
  3. 06.03
    Palindrome Check
    回文判断
    python-strings 20m
  4. 06.04
    Find First Match
    找首个匹配
    python-strings python-loops 20m
  5. 06.05
    Homework: Text Statistics
    作业: 文本统计
    python-strings python-functions python-lists 45m
Chapter 07

File I/O

文件输入输出

≈ 110 min · 5 lessons

Persistence. open() / with / read / write / append. The shape of every batch data job: read, process, write. Strictly aligned with Automate the Boring Stuff with Python chapter 9.

  1. 07.01
    Walkthrough: Write Then Read
    例题: 写入再读取
    python-file-io 8m
  2. 07.02
    Read CSV-Lite
    读 CSV 文件
    python-file-io python-strings python-lists 20m
  3. 07.03
    Append a Log
    追加日志
    python-file-io 20m
  4. 07.04
    Count Lines
    数行
    python-file-io python-loops 15m
  5. 07.05
    Homework: Word-Frequency Report
    作业: 词频报告
    python-file-io python-strings python-lists 45m
Chapter 08

Command-Line Interface

命令行接口

≈ 110 min · 5 lessons

Scripts become tools. sys.argv for the raw approach, argparse for proper ones — with --help, type validation, defaults, and exit codes for free. Build a Unix wc clone.

  1. 08.01
    Walkthrough: sys.argv Greeter
    例题: 命令行问候
    python-cmdline 8m
  2. 08.02
    Sum from argv
    命令行求和
    python-cmdline 15m
  3. 08.03
    argparse Basics
    argparse 入门
    python-cmdline 20m
  4. 08.04
    argparse Defaults
    argparse 默认值
    python-cmdline 20m
  5. 08.05
    Homework: wc Clone
    作业: wc 克隆
    python-cmdline python-file-io python-functions 45m
Chapter 09

Recursion

递归

≈ 110 min · 5 lessons

A function calls itself. With a base case to stop, recursion is the cleanest way to express problems that are naturally self-similar — factorial, fibonacci, list traversal, Euclid’s GCD. Strictly aligned with Think Python §5.7-§5.10 + §6.6-§6.9.

  1. 09.01
    Walkthrough: Recursive Countdown
    例题: 递归倒计时
    python-recursion 8m
  2. 09.02
    Factorial
    阶乘
    python-recursion 15m
  3. 09.03
    Fibonacci
    斐波那契数列
    python-recursion 20m
  4. 09.04
    Sum List Recursively
    递归求列表和
    python-recursion python-lists 15m
  5. 09.05
    Homework: GCD + Power
    作业: 最大公约数 + 幂
    python-recursion 45m
Chapter 10

Decomposition

程序分解

≈ 110 min · 5 lessons

How to write a 200-line program without going crazy. Incremental development (small steps, scaffolding, test as you go) + composition (assemble small functions into bigger ones). Strictly aligned with Think Python §3.11, §6.2, §6.3.

  1. 10.01
    Walkthrough: Distance (Incremental Build)
    例题: 距离 (增量构建)
    python-decomposition python-functions 10m
  2. 10.02
    Hypotenuse
    斜边
    python-decomposition python-functions 15m
  3. 10.03
    Area of Shapes
    多形状求面积
    python-decomposition python-functions 20m
  4. 10.04
    Refactor Monolith
    拆分大函数
    python-decomposition python-functions 25m
  5. 10.05
    Homework: GPA Calculator
    作业: GPA 计算器
    python-decomposition python-functions 40m