U5l11 Activity Guide - Flowcharts With While Loops
U5l11 Activity Guide - Flowcharts With While Loops
Introduction
We are going to be learning a new programming structure today called while loops. while loops allow us to
control program flow by repeating a set of commands until a condition is met. When we control program flow it
is often helpful to think about the ideas in a visual way first. You will use flowcharts to begin thinking about while
loops.
Flowchart Components
As a reminder we have included the flowchart components here as a reference for you as you work on this sheet.
Each flowchart below contains a “loop” that runs “while” a condition is true. Investigate each flowchart, mark
how many times you believe the loop will run on the line provided, and then justify your reasoning.
Note: There may be many possible answers, so pick the one you believe makes the most sense.
|-------------------------------------------------|
Never A few times Forever
Justification: The loop would only run while the person needs more sleep.
How many times will the loop run?
|-------------------------------------------------|
Never A few times Forever
Justification: The loop would run while the person does not understand something.
Complete this flowchart with a real-life while loop of your own choosing. Exchange with a partner and see
how many times they think your loop would run.
Output:
2
Output: