Module 5: Control Flow
Beginner 15 chapters
56. Introduction to Conditional Statements
Understand what conditional statements are, how Python decides between actions using True and False, and how comparison and logical operators build conditions.
57. if Statement
Learn the if statement: how to run code only when a condition is true, how indentation defines the block, and how to write clean one-way decisions.
58. if-else Statement
Learn how if-else gives your program two paths: one block runs when a condition is true and another runs when it is false. Includes truthy values, ranges and the one-line conditional expression.
59. if-elif-else Statement
Use elif to choose between three or more outcomes. Learn how the ladder is checked top to bottom, why order matters, and when to use separate ifs instead.
60. Nested Conditions
Learn to place one if statement inside another. See how indentation links each else to its if, when to flatten with and, and how to keep nesting shallow.
61. Match-Case Statement
Meet the match-case statement added in Python 3.10. Learn value patterns, the wildcard, alternatives with |, guards, and matching sequences and dictionaries.
62. Introduction to Loops
Learn why programs need loops, what repetition looks like without them, and how Python's two loop types, for and while, let you repeat work safely.
63. for Loop
Learn how the for loop visits each item of a list, string, tuple, dictionary or range, and how to use enumerate, zip, nested loops and loop else.
64. while Loop
Learn how the while loop repeats code while a condition is true, how to avoid infinite loops, and how to use sentinel values, break, continue and else.
65. range() Function
Learn how range() creates a sequence of numbers with start, stop and step, how to count up and down, and how to use it with for loops and list indexes.
66. break Statement
Learn how the break statement ends a loop early, how it works in for and while loops, and how it behaves inside nested loops and with the loop else clause.
67. continue Statement
Learn how the continue statement skips the rest of the current loop iteration, how it differs from break, and how to use it to filter values and keep loop code flat.
68. pass Statement
Learn what the pass statement is, why Python needs an empty placeholder, and how to use it in if blocks, loops, functions and classes while you build a program step by step.
69. Nested Loops
Learn how to place one loop inside another, trace how the inner and outer loops run together, and use nested loops to print patterns, tables and grids.
70. Loop Else
Learn the else clause on for and while loops: it runs only when the loop finishes without hitting break. Use it for clean search patterns without extra flag variables.