

Python - Introduction to While Loops
Presentation
•
Computers
•
8th - 11th Grade
•
Medium
Martin Dunn
Used 118+ times
FREE Resource
10 Slides • 9 Questions
1
Python - While Loops

2
While Loops
A while loop is a block of code that will keep repeating until a condition has been met.
3
Looping (Iteration)
Looping code in programming is called "Iteration"
You can re-use the same code over and over again.
This saves on the amount of code you have to write.
4
Example
This example asks you what the capital city of France is.
It keeps asking the same question if your answer is not Paris.
5
Multiple Choice
6
Multiple Choice
Why is iteration (looping) important?
It determines the order in which instructions are carried out
It allows code to be simplified by removing duplicated steps
It allows multiple paths through a program
It ensures the code works correctly
7
Conditions that cause and stop a loop.
Loops can sometime be stuck in an infinite loop
8
This can be fixed by asking for a user input for the variable "play" during each loop.
The loop will carry on if you type "yes" (meeting the condition)
Typing anything else will stop the loop.
9
Using a Counter
This loop will print out "Let's play" each time is runs.
After every loop, the counter increases by one.
It continue to loop while the counter is less than 5
What happens when the counter reaches 5?
10
Multiple Choice
How many times will this program print out "Let's play before the loop stops?"
4
5
0
9
11
Whay was the answer 5 times?
The counter for the loop begins at 0.
the looping happened when the counter was 0,1,2,3 and 4
12
Multiple Choice
How many times will this loop run before it exits?
3
5
4
10
13
Conditions
Equal to ==
Less than <
Greater Than >
Less than or equal to <=
Greater than or equal to >=
Not equal to !=
14
Multiple Choice
15
Multiple Choice
16
Multiple Choice
17
Multiple Choice
18
Multiple Choice
Which type of loop iterates (loops) until instructed otherwise?
FOR loop
A count-controlled loop
Repeat-once loop
WHILE loop
19
Using "break" to end a loop
In this example, the loop is still set to run 5 times.
On each loop you are asked the question "what is 2+2".
If you answer correctly, you are told "correct" and the loop breaks.
Python - While Loops

Show answer
Auto Play
Slide 1 / 19
SLIDE
Similar Resources on Wayground
13 questions
Ilmu Pengetahuan Alam
Presentation
•
KG
15 questions
Physical Science Review
Presentation
•
8th - 11th Grade
15 questions
9-1 Scatter Plots
Presentation
•
8th - 11th Grade
13 questions
Clase 1 - Introducción a la Programación
Presentation
•
11th - 12th Grade
12 questions
converting standard form to slope intercept form
Presentation
•
8th - 11th Grade
15 questions
Flowchart and Pseudocode Exercise
Presentation
•
8th - 11th Grade
13 questions
Hacking
Presentation
•
9th - 12th Grade
15 questions
Media Terminology & Copyright Law 2023
Presentation
•
9th - 12th Grade
Popular Resources on Wayground
20 questions
STAAR Review Quiz #3
Quiz
•
8th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
6 questions
Marshmallow Farm Quiz
Quiz
•
2nd - 5th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
20 questions
Inferences
Quiz
•
4th Grade
19 questions
Classifying Quadrilaterals
Quiz
•
3rd Grade
12 questions
What makes Nebraska's government unique?
Quiz
•
4th - 5th Grade
Discover more resources for Computers
20 questions
STAAR Review Quiz #3
Quiz
•
8th Grade
7 questions
Warm Up 04.01.2026
Quiz
•
9th Grade
8 questions
Amoeba Sister Asexual vs Sexual Reproduction
Interactive video
•
8th Grade
50 questions
STAAR English 2 Review
Quiz
•
10th Grade
15 questions
Pythagorean Theorem Word Problems Quizizz
Quiz
•
8th Grade
20 questions
Graphing Inequalities on a Number Line
Quiz
•
6th - 9th Grade
4 questions
Spring Break rest and recharge
Presentation
•
6th - 8th Grade
20 questions
Figurative Language Review
Quiz
•
10th Grade