

Python - Introduction to While Loops
Presentation
•
Computers
•
8th - 11th Grade
•
Medium
Martin Dunn
Used 126+ 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
17 questions
Social Media
Presentation
•
9th - 12th Grade
17 questions
Study Skills 1
Presentation
•
9th - 11th Grade
14 questions
FUTURE TENSES
Presentation
•
8th - 10th Grade
14 questions
Rotations
Presentation
•
8th - 10th Grade
14 questions
Third Conditional
Presentation
•
8th - 10th Grade
15 questions
Adjetivos demostrativos
Presentation
•
KG
13 questions
Earth's Biogeochemical Cycles
Presentation
•
8th - 12th Grade
14 questions
Electron Math
Presentation
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
Safety Day 2026 – Student Review
Quiz
•
9th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
12 questions
Map Skills
Quiz
•
3rd Grade
22 questions
Continents and Oceans
Quiz
•
5th Grade
15 questions
Rounding Decimals
Quiz
•
5th Grade
Discover more resources for Computers
32 questions
Unit 3: Intro to App Design (APCSP 22-23, Code.org)
Quiz
•
9th - 12th Grade
30 questions
[AP CSP] Spreadsheets Review
Quiz
•
9th Grade
10 questions
Digital Citizenship: Part 1
Quiz
•
6th - 8th Grade
15 questions
AP CSP - Code.org Unit 3 Review
Quiz
•
9th - 12th Grade
40 questions
Introduction to Microsoft Word
Quiz
•
8th - 12th Grade