๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_while_loops.asp
Python While Loops
With the break statement we can stop the loop even if the while condition is true: ... Note: The else block will NOT be executed if the loop is stopped by a break statement. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com ยท If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com ยท HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python ...
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ gloss_python_while.asp
Python While
Python Training ... With the while loop we can execute a set of statements as long as a condition is true. ... Note: remember to increment i, or else the loop will continue forever.
Discussions

As a beginner how do I understand while loops?
Itโ€™s just a loop which continues running until the condition becomes false. More on reddit.com
๐ŸŒ r/learnpython
76
36
April 10, 2025
Reddit
Subreddit for posting questions and asking for general advice about all topics related to learning python. More on reddit.com
๐ŸŒ r/learnpython
October 29, 2018
[Python] Why would I use a for loop instead of a while loop?

for means "do something with each of these things".

while means "keep doing this until something is no longer true".

So... say what you mean. Readability counts.

More on reddit.com
๐ŸŒ r/learnprogramming
59
49
November 15, 2011
I've trying to learn while loops for over 2 weeks... Help? [ELI5]

You have two variables, m and c. The variable m is what the user inputs to determine what height the ball is dropped from. The variable c will count the number of bounces.

Then the while loop starts. Quite literally, while the ball bounces back to a height that is greater than 0.01, your program keeps executing the rest of the code over and over.

In this specific case, your program first decreases the height to 70% of previous value (so it bounces back lower due to gravity), then increments the c counter by one, so says the ball bounces one time.

Then the instruction in the while loop is over. The program checks again if the height m is greater than 0.01. If it is, it will keep repeating the while loop code block until the condition is no longer met. If it isn't, it will do the rest of the code. In this example it will print that the ball has bounced c number of times.

You print c because that is the variable where you store number of bounces. If you printed m it would print the height the ball is at right now, after all those operations. Which would mean it would print a number that's less than 0.01.

More on reddit.com
๐ŸŒ r/learnpython
10
3
February 21, 2018
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ exercise.asp
Exercise: - Python While Loops
You completed the Python While Loops Exercises from W3Schools.com ยท Share on: Next Exercise ยป ยท
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_keyword_while.asp
Python while Keyword
Python Examples Python Compiler ... Interview Q&A Python Bootcamp Python Certificate Python Training ... The while keyword is used to create a while loop....
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_challenges_while_loops.asp
Python While Loops Code Challenge
Test your understanding of Python while loops by completing a small coding challenge. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com
๐ŸŒ
W3Schools
w3schoolsua.github.io โ€บ python โ€บ python_while_loops_en.html
Python While Loops. Lessons for beginners. W3Schools in English
Python While Loops. Python has two primitive loop commands: while loops, for loops. The while Loop. The break Statement. The continue Statement. The else Statement. Test Yourself With Exercises. Examples. Lessons for beginners. W3Schools in English
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_lists_loop.asp
Python - Loop Lists
Learn more about while loops in our Python While Loops Chapter. List Comprehension offers the shortest syntax for looping through lists: A short hand for loop that will print all items in a list: thislist = ["apple", "banana", "cherry"] [print(x) for x in thislist] Try it Yourself ยป ยท Learn more about list comprehension in the next chapter: List Comprehension. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com
๐ŸŒ
W3Schools
w3schools.io โ€บ python-while-loop
How to write While and do while loop with examples - w3schools
Python basics while and do while loop with infinite, break, continue, else clause examples for beginner, developer, and experienced.
Find elsewhere
๐ŸŒ
W3Schools
w3schools.in โ€บ python โ€บ loops
Python Loops - W3Schools
#initialize count variable to 1 count =1 while count < 6 : print (count) count+=1 #the above line means count = count + 1 ... 1 * 1 = 1 1 * 2 = 2 2 * 1 = 2 2 * 2 = 4 3 * 1 = 3 3 * 2 = 6 4 * 1 = 4 4 * 2 = 8 5 * 1 = 5 5 * 2 = 10 ยท These statements are used to change execution from its normal sequence. Python supports three types of loop control statements:
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ trypython.asp
W3Schools online PYTHON editor
The W3Schools online code editor allows you to edit code and view the result in your browser
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ gloss_python_while_else.asp
Python While Else
Python Tuples Access Tuples Update Tuples Unpack Tuples Loop Tuples Join Tuples Tuple Methods Tuple Exercises Code Challenge Python Sets
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ gloss_python_while_continue.asp
Python While Continue
Python Tuples Access Tuples Update Tuples Unpack Tuples Loop Tuples Join Tuples Tuple Methods Tuple Exercises Code Challenge Python Sets
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ while-loop
Python while Loop (With Examples)
while True: user_input = input("Enter password: ") # terminate the loop when user enters exit if user_input == 'exit': print(f'Status: Entry Rejected') break print(f'Status: Entry Allowed') ... Before we wrap up, letโ€™s put your knowledge of Python while loop to the test!
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-do-while-loop-example
Python Do While โ€“ Loop Example
August 31, 2021 - The while loop, on the other hand, doesn't run at least once and may in fact never run. It runs when and only when the condition is met. So, let's say we have an example where we want a line of code to run at least once. secret_word = "python" counter = 0 while True: word = input("Enter the secret word: ").lower() counter = counter + 1 if word == secret_word: break if word != secret_word and counter > 7: break
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_tuples_loop.asp
Python - Loop Tuples
Use the len() function to determine the length of the tuple, then start at 0 and loop your way through the tuple items by referring to their indexes. Remember to increase the index by 1 after each iteration. Print all items, using a while loop to go through all the index numbers:
๐ŸŒ
YouTube
youtube.com โ€บ watch
While loops in Python are easy! โ™พ๏ธ
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_keyword_continue.asp
Python continue Keyword
Python Examples Python Compiler ... Certificate Python Training ... The continue keyword is used to end the current iteration in a for loop (or a while loop), and continues to the next iteration....