W WolfCode · CSC 141
Chapter 02

Conditionals

条件分支

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

Strict source: Think Python §5.1–§5.6 (Boolean Expressions · Logical Operators · Conditional / Alternative / Chained / Nested Conditionals).

Lessons in this chapter

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