Offline-ready notes · progress saves on this device
Project LibraryStudy workspace →
Courses/Digital Literacy/Lesson 4

Lesson 4 of 5

Programming Fundamentals

Read the overview in
English overview

Use print statements, booleans, variables, operators, loops, and conditionals to understand how a Python program stores information and controls what happens next.

9:26 lectureBeginner10 video chapters30 flashcards + 30 questions
Official Binary Tree uploadDigital Literacy Week 4Published 2026-08-06 · embedded with chapters, checkpoints, deep notes, and a project

Four clear stages

Learn → Project → Check → Finish

Watch and work through the lecture
  1. 1LearnWatch and work through the lectureUse the chapter notebook and answer each video checkpoint.Do this now
  2. 2ProjectCode a three-guess number gamePlan it, create it, then prove it meets the definition of done.Next
  3. 3CheckAnswer all 30 questionsCorrect weak spots using the explanation after each answer.Next
  4. 4FinishMark the lesson completeThen move to Lists, Functions & Reusable Logic.Next
Course outlineDigital Literacy

Interactive lecture

Watch, pause, think, apply.

Use Python values, variables, operators, and if/elif/else branches to explain and solve a small decision problem.

0:003 thinking points marked9:26

Numbered markers show where the video will pause. Seeking past one opens the first unanswered check.

Connecting to the lecture…Open on YouTube ↗

Chapter-by-chapter lecture notebook

Everything in the video, organized for learning

The lecture pairs syntax with real code searching. This guide emphasizes understanding and testing code instead of copying snippets.

Source reviewed9:26 lectureReviewed against the public lecture with timestamped slide sampling across the full runtime and cross-checked against the source lesson context.
10

video chapters mapped into notes, examples, and a concrete action.

This is a detailed learning companion reconstructed from the reviewed lecture—not a verbatim transcript.
01
0:00 in the lecturePrint a first result
What the video is teaching

print displays a representation of a value. Variables name values, and each value has a type that determines sensible operations.

Predict the type and output before running. Use descriptive names and verify that operations match the meaning of the data.

What to noticeWorked example

score = 8 stores an integer; passed_course = score >= 6 stores a Boolean; print(passed_course) displays True.

Do this before continuing

Create four variables of different types and predict five printed expressions.

Replay this chapter on YouTube ↗
02
0:45 in the lectureBooleans
What the video is teaching

print displays a representation of a value. Variables name values, and each value has a type that determines sensible operations.

Predict the type and output before running. Use descriptive names and verify that operations match the meaning of the data.

What to noticeWorked example

score = 8 stores an integer; passed_course = score >= 6 stores a Boolean; print(passed_course) displays True.

Do this before continuing

Create four variables of different types and predict five printed expressions.

Replay this chapter on YouTube ↗
03
1:45 in the lectureVariables and types
What the video is teaching

print displays a representation of a value. Variables name values, and each value has a type that determines sensible operations.

Predict the type and output before running. Use descriptive names and verify that operations match the meaning of the data.

What to noticeWorked example

score = 8 stores an integer; passed_course = score >= 6 stores a Boolean; print(passed_course) displays True.

Do this before continuing

Create four variables of different types and predict five printed expressions.

Replay this chapter on YouTube ↗
04
2:45 in the lectureOperators and operands
What the video is teaching

Arithmetic, comparison, logical, and assignment operators build expressions. Precedence and type determine the result.

Add parentheses when intent is not obvious and test boundary cases around comparisons.

What to noticeWorked example

age >= 13 and has_permission combines two Boolean expressions; both must be true for the complete expression to be true.

Do this before continuing

Write a truth table for two Boolean inputs and one and/or expression.

Replay this chapter on YouTube ↗
05
3:40 in the lectureIf statements and indentation
What the video is teaching

if tests the first condition, elif tests another only when earlier branches fail, and else handles the remaining case. Indentation defines the block that belongs to each branch.

Order branches from specific to general, avoid unreachable cases, and cover exact boundaries such as 0, passing score, or maximum capacity.

What to noticeWorked example

An even-or-odd program checks number % 2 == 0; the else branch handles odd integers.

Do this before continuing

Write and run a three-branch classification with tests just below, at, and above each boundary.

Replay this chapter on YouTube ↗
06
4:35 in the lectureElif branches
What the video is teaching

if tests the first condition, elif tests another only when earlier branches fail, and else handles the remaining case. Indentation defines the block that belongs to each branch.

Order branches from specific to general, avoid unreachable cases, and cover exact boundaries such as 0, passing score, or maximum capacity.

What to noticeWorked example

An even-or-odd program checks number % 2 == 0; the else branch handles odd integers.

Do this before continuing

Write and run a three-branch classification with tests just below, at, and above each boundary.

Replay this chapter on YouTube ↗
07
5:30 in the lectureElse fallback
What the video is teaching

if tests the first condition, elif tests another only when earlier branches fail, and else handles the remaining case. Indentation defines the block that belongs to each branch.

Order branches from specific to general, avoid unreachable cases, and cover exact boundaries such as 0, passing score, or maximum capacity.

What to noticeWorked example

An even-or-odd program checks number % 2 == 0; the else branch handles odd integers.

Do this before continuing

Write and run a three-branch classification with tests just below, at, and above each boundary.

Replay this chapter on YouTube ↗
08
6:25 in the lectureFind and analyze real code
What the video is teaching

GitHub and Stack Overflow can reveal patterns, but snippets may be outdated, insecure, incomplete, or licensed under conditions. Understand purpose, inputs, branches, operators, and context before adaptation.

Trace the code, run it with harmless samples, inspect the source and date, and rewrite it in your own structure with attribution where required.

What to noticeWorked example

A body-mass-index snippet is not reused until the learner checks units, invalid input, formula, category boundaries, and whether health interpretation is appropriate.

Do this before continuing

Choose one small conditional snippet and write a line-by-line explanation plus two missing tests.

Replay this chapter on YouTube ↗
09
7:25 in the lectureGitHub and Stack Overflow examples
What the video is teaching

GitHub and Stack Overflow can reveal patterns, but snippets may be outdated, insecure, incomplete, or licensed under conditions. Understand purpose, inputs, branches, operators, and context before adaptation.

Trace the code, run it with harmless samples, inspect the source and date, and rewrite it in your own structure with attribution where required.

What to noticeWorked example

A body-mass-index snippet is not reused until the learner checks units, invalid input, formula, category boundaries, and whether health interpretation is appropriate.

Do this before continuing

Choose one small conditional snippet and write a line-by-line explanation plus two missing tests.

Replay this chapter on YouTube ↗
10
8:40 in the lectureRun an even-or-odd program
What the video is teaching

GitHub and Stack Overflow can reveal patterns, but snippets may be outdated, insecure, incomplete, or licensed under conditions. Understand purpose, inputs, branches, operators, and context before adaptation.

Trace the code, run it with harmless samples, inspect the source and date, and rewrite it in your own structure with attribution where required.

What to noticeWorked example

A body-mass-index snippet is not reused until the learner checks units, invalid input, formula, category boundaries, and whether health interpretation is appropriate.

Do this before continuing

Choose one small conditional snippet and write a line-by-line explanation plus two missing tests.

Replay this chapter on YouTube ↗

Deep explanations

The ideas behind each chapter

Use these sections when the video moves quickly or you need another example.

010:00

Connect values, variables, and output

print displays a representation of a value. Variables name values, and each value has a type that determines sensible operations.

Predict the type and output before running. Use descriptive names and verify that operations match the meaning of the data.

Worked example

score = 8 stores an integer; passed_course = score >= 6 stores a Boolean; print(passed_course) displays True.

Try it now

Create four variables of different types and predict five printed expressions.

022:45

Read expressions from operands and operators

Arithmetic, comparison, logical, and assignment operators build expressions. Precedence and type determine the result.

Add parentheses when intent is not obvious and test boundary cases around comparisons.

Worked example

age >= 13 and has_permission combines two Boolean expressions; both must be true for the complete expression to be true.

Try it now

Write a truth table for two Boolean inputs and one and/or expression.

033:40

Build one complete decision chain

if tests the first condition, elif tests another only when earlier branches fail, and else handles the remaining case. Indentation defines the block that belongs to each branch.

Order branches from specific to general, avoid unreachable cases, and cover exact boundaries such as 0, passing score, or maximum capacity.

Worked example

An even-or-odd program checks number % 2 == 0; the else branch handles odd integers.

Try it now

Write and run a three-branch classification with tests just below, at, and above each boundary.

046:25

Evaluate found code before using it

GitHub and Stack Overflow can reveal patterns, but snippets may be outdated, insecure, incomplete, or licensed under conditions. Understand purpose, inputs, branches, operators, and context before adaptation.

Trace the code, run it with harmless samples, inspect the source and date, and rewrite it in your own structure with attribution where required.

Worked example

A body-mass-index snippet is not reused until the learner checks units, invalid input, formula, category boundaries, and whether health interpretation is appropriate.

Try it now

Choose one small conditional snippet and write a line-by-line explanation plus two missing tests.

Language of the lesson

Know these ideas

Boolean
A True or False value.
Variable
A name referencing a value.
Operator
A symbol or keyword that performs an operation.
Operand
A value an operator acts on.
Conditional
A branch controlled by a Boolean expression.
Indentation
Leading space that defines Python code blocks.

Reason like a practitioner

Misconceptions to correct

  • Quoted "False" behaves like False.A non-empty string is truthy and is not the Boolean False.
  • Every elif is checked after a true if.A chain stops at the first true branch.
  • Code found online is ready to paste.It needs source, context, logic, safety, and test review.
Transfer challenge

Build a three-branch Python decision program, explain every variable and operator, and test normal, boundary, and invalid inputs before comparing it with an online example.

Lesson project · Python program

Code a three-guess number game

A checked comparison function that reports equal, too high, or too low and handles invalid input.

0%0 of 5 checks
Your brief

Create a number game that stores a target, asks for a guess, and prints whether the guess is equal, too high, or too low. Repeat for three guesses.

  1. 1
    Plan the work

    State the goal, audience or user, and the evidence a strong result needs. Explain how Boolean changes your plan.

  2. 2
    Build and test

    Create a number game that stores a target, asks for a guess, and prints whether the guess is equal, too high, or too low. Repeat for three guesses.

  3. 3
    Prove and improve

    Use Operator and Control flow to check the result. Record one piece of evidence, one correction, and one improvement you would make next.

Offline referenceRead the independent walkthrough and practice notes

Why this lesson matters

Use print statements, booleans, variables, operators, loops, and conditionals to understand how a Python program stores information and controls what happens next.

The goal is not to memorize vocabulary. By the end of the lesson, you should be able to use the ideas in a realistic situation, explain the reason for your choices, and check whether the result actually works for the intended person or task.

Learning objectives

  • Explain Boolean in your own words.
  • Apply Operator to a realistic classroom or community example.
  • Connect Boolean with Control flow when making a decision.
  • Complete the practice task and reflect on one improvement.

Core ideas

1. Boolean

A true-or-false value, often produced by a comparison, that a program can use to decide whether a block should run.

In practice: Look for this idea while you complete the lesson task. Pause before each major step and explain how Boolean changes what you choose, create, or check.

2. Operator

A symbol such as +, -, *, /, ==, or > that performs a calculation or comparison on values.

In practice: Look for this idea while you complete the lesson task. Pause before each major step and explain how Operator changes what you choose, create, or check.

3. Control flow

The path a program follows through sequential statements, conditional branches, and repeated loops.

In practice: Look for this idea while you complete the lesson task. Pause before each major step and explain how Control flow changes what you choose, create, or check.

How the ideas connect

Start with Boolean to understand the foundation of the lesson. Use Operator to turn that understanding into an action. Then apply Control flow to check the quality, safety, or usefulness of the result. The three ideas are strongest when you can explain their relationship rather than treating them as separate definitions.

Guided walkthrough

  1. Name the goal. In one sentence, write what you are trying to understand, create, or improve.
  2. Make a prediction. Before touching a device, use Boolean and Operator to predict what a strong result should look like.
  3. Complete the task. Create a number game that stores a target, asks for a guess, and prints whether the guess is equal, too high, or too low. Repeat for three guesses.
  4. Check the outcome. Use Control flow to inspect the result. Ask what worked, what did not, and what evidence supports your judgment.
  5. Explain and revise. Tell a partner what you changed and why. Make one small improvement, then compare the new result with the first one.

Worked classroom scenario

Imagine two learners sharing one device. The first learner is the driver and performs the steps; the second is the navigator and reads the goal, predicts the next step, and checks the result. Halfway through the task, switch roles. Both learners should be able to explain how Boolean, Operator, and Control flow appeared in the work.

If no device is available, complete the same reasoning on paper: sketch the screen or result, label each decision, and describe what you would test when a device becomes available.

Common mistakes and fixes

  • Rushing into the tool: Write the goal and prediction first so every click or step has a reason.
  • Copying without understanding: After each major step, explain it in your own words to a partner.
  • Accepting the first result: Compare the outcome with the goal and make at least one deliberate improvement.
  • Letting one person control a shared device: Rotate driver and navigator roles so both learners think and practice.

Independent practice

Create a number game that stores a target, asks for a guess, and prints whether the guess is equal, too high, or too low. Repeat for three guesses.

For an extra challenge, adapt the task for a different audience or community need. Write two sentences explaining what changed and which lesson idea guided your decision.

Check your understanding

  1. How would you explain Boolean to someone new to the topic?
  2. What is one realistic example of Operator outside this classroom?
  3. When might Control flow prevent a weak, unsafe, or confusing result?
  4. How are Boolean and Operator connected?
  5. What evidence would convince you that your practice result works?
  6. If you repeated the activity tomorrow, what would you improve first and why?

Key takeaway

Use print statements, booleans, variables, operators, loops, and conditionals to understand how a Python program stores information and controls what happens next.

You are ready to move on when you can explain the three core ideas, complete the practice without copying, and describe one improvement using evidence from your result.