

Python - Introduction to While Loops
Presentation
•
Computers
•
8th - 11th Grade
•
Medium
Martin Dunn
Used 121+ 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
12 questions
Anne Frank Character Change
Presentation
•
6th - 9th Grade
14 questions
Hardware
Presentation
•
8th - 11th Grade
17 questions
Genetics Review Part 2 (Practice)
Presentation
•
6th - 9th Grade
17 questions
Text Structures Lesson
Presentation
•
8th - 11th Grade
16 questions
Data Representation - Sound
Presentation
•
9th - 11th Grade
15 questions
Do Now: Present tense regulars
Presentation
•
8th - 11th Grade
16 questions
Special Segments in Triangles
Presentation
•
8th - 11th Grade
12 questions
Rotation
Presentation
•
8th - 11th Grade
Popular Resources on Wayground
11 questions
Hallway & Bathroom Expectations
Quiz
•
6th - 8th Grade
10 questions
HCS SCI 03 Summer School Assessment 2
Quiz
•
3rd Grade
11 questions
Home Scope
Quiz
•
7th - 8th Grade
12 questions
2026 TAP Technology in the Classroom
Presentation
•
Professional Development
15 questions
HCS SCI 05 Summer School Assessment 2 Review
Quiz
•
5th Grade
15 questions
HCS SCI 04 Summer School Review 2
Quiz
•
4th Grade
59 questions
Geometry Unit 3 Review
Quiz
•
9th - 12th Grade
14 questions
FAST ELA READING SMAPLE TEST MATERIALS
Passage
•
3rd Grade