Specialty Digest

Global English editionLearners’ Study Dashboard — in development
The Knowledge Library for All

Online Courses / University Track / Python from Zero

Module 2 of 8

Decisions: Comparison and if Statements

Teach a program to choose. Compare values, run lines only when a condition is true, handle several cases and test the edges where decisions go wrong.

  • 6 hours
  • Outcomes O3
  • Checkpoint: 80% to unlock Module 3

Big idea. A condition is a question with a True or False answer, and an if statement uses it to decide which lines run.

Outcomes served. O3 (write programs that make decisions).

Plan your six hours

Assumed. Module 1: print, variables, numbers, text and input with int().

Where this topic appears in practice. Every real program decides: whether a customer gets a discount, whether a password is long enough, whether a sensor reading is a warning. These all use the conditions in this module.

Privacy. Your answers stay with you. This course does not store, collect or send anything you write or tick.