Skip to content
    Hack The FutureHack The FuturePython Notes

    UNIT 02 · TOPIC 11

    Control Flow – if, if-else, if-elif-else

    Conditional statements choose which block to execute based on a boolean condition.

    The idea

    Control Flow – if, if-else, if-elif-else, simply explained

    Conditional statements choose which block to execute based on a boolean condition.

    01

    See the big picture

    How the idea flows

    Input or goalControl Flow – if, …Python result
    Understand the problemApply Control Flow – if, if-else, if-…Run the codeCheck the output

    Read the diagram as a simple path: begin with a problem, use the Python idea, then verify the result.

    02

    Everyday connection

    Real-life example

    ↗

    A grading system selects a result band based on the learner's score.

    03

    Learn by doing

    Python code example

    PYTHONExample
    score = 78
    if score >= 90:
        grade = 'A'
    elif score >= 60:
        grade = 'B'
    else:
        grade = 'C'
    print(grade)
    Expected resultB
    Try it: Change one value in the code, predict what will happen, then run it and compare your answer.
    04

    Keep this in mind

    Key takeaways

    • Conditional statements choose which block to execute based on a boolean condition.
    • Think of a real problem where control flow – if, if-else, if-elif-else could save time or organize information.
    • Test small changes and read the result carefully before moving to a bigger program.

    Quick self-check

    Can you explain it in your own words?

    What is the main idea of Control Flow – if, if-else, if-elif-else?

    Conditional statements choose which block to execute based on a boolean condition.

    Where could you see this idea in everyday life?

    A grading system selects a result band based on the learner's score.

    Keep learning · Hack The Future