This week’s topics
Making decisions: if, elif and else
- Comparison operators
- Choosing between options
What you will be able to do
- 2.2 Implement sequence, selection, and iteration structures.
Activity
Write a program that turns a test score into a grade.
Study materials
Further resources
- Introduction to Python Programming, ch. 4: Decisions · PDF · OpenStax Introduction to Python Programming (2024), ch. 4: comparison operators, if-else and elif chains, pp. 85–113 · for registered students
- Think Python, ch. 5: Conditionals and recursion · PDF · Downey, Think Python 2e (Green Tea Press), ch. 5: Boolean expressions and chained conditionals, pp. 39–50 · for registered students
- Python Notes for Professionals, ch. 14–15: Conditionals, comparisons · PDF · GoalKicker Python Notes for Professionals, ch. 14–15: if/elif/else and comparison operators, pp. 80–90 · for registered students
- A case against the GO TO statement (EWD 215) · Open-access article · Dijkstra (1968), Communications of the ACM (published as 'Go To Statement Considered Harmful'). Two-page classic arguing for structured if/else instead of jumps. · for registered students
Materials marked “for registered students” open in the student portal, which is set up as soon as you receive final acceptance.