Chapter 1 B1U3 Conditional Execution

This is supplementary material for the corresponding lesson from Python for Everybody.

1.1 Lecture on Analogies

This lecture is not directly related to lesson 2. It shows real-life analogies to gain a better intuition of what programming is about.

  1. Road analogy
    • Definition of program control flow.
    • Road as control flow analogy (from Head Frist Programming): sequence, alternative, interconnecting paths, loop.
  2. Cooking analogy
    • Cooking from a cookbook and execution of a program.
    • Recipes and programs and their corresponding components.
    • A recipe in a pseudo-code.
  3. Comparison, aka putting all together
    • road and cooking analogy,
    • flow diagrams,
    • statements from a block programming language,
    • statements in Python.
  4. Iterations
    • Motivation for iterations on an example interval running training definition.
    • Checking attendance as an example of different iterations (pseudo-code).
  5. Errors
    • Comparison of syntax and semantics in natural and programming languages.
    • Basic types of errors with examples.
198801 U02 10 analogies 01 road
duration: 05:18
198801 U02 10 analogies 02 cooking
duration: 05:22
198801 U02 10 analogies 03 comparison
duration: 10:38
198801 U02 10 analogies 04 iterations
duration: 05:58
198801 U02 10 analogies 05 errors
duration: 06:01
total duration: 33:17

Slides:

1.2 Exercises on Conditional Execution

198801 U03 20 demo 01 tasks
duration: 09:50
198801 U03 20 demo 02 SqFeet
duration: 11:56
198801 U03 20 demo 03 debugging
duration: 02:56
total duration: 24:42

Exercises:

  • the material is provided in OLAT