For: print out only even numbers between 1 and 100. Now do it without using an if statement. While: Ask the user for a secret password. Keep going until they get it right. Now do the same without using an if statement. These are probably the most basic ideas. Once you have them down, you can build on your knowledge. Answer from vikingvynotking on reddit.com
🌐
PYnative
pynative.com › home › python exercises › python loops exercises: 40+ coding problems with solutions
40 Python Loops Coding Exercises with Solutions – PYnative
June 13, 2026 - The code inside will keep running ... Write a program to display numbers from -10 to -1 using a for loop. Exercise Purpose: This exercise focuses on Negative Indexing and Ranges....
🌐
Mkzia
mkzia.github.io › eas503-book › chapters › 06 › while_loop_exercises.html
6.3. While Loop Exercises — EAS503: Python for Data Scientists
Write a program that takes integers from the user and returns the average. Use a while loop and make an empty string the stop criteria.
Discussions

Ideas for practicing for and while loops?

For: print out only even numbers between 1 and 100. Now do it without using an if statement.

While: Ask the user for a secret password. Keep going until they get it right. Now do the same without using an if statement.

These are probably the most basic ideas. Once you have them down, you can build on your knowledge.

More on reddit.com
🌐 r/learnpython
34
56
October 2, 2020
Some while loop exercises

What can maybe help as well is to run the snippets at http://www.pythontutor.com/visualize.html as then you can walk through them step by step, also seeing the values of the variables.

More on reddit.com
🌐 r/learnpython
9
2
April 20, 2020
For loops and while loops
I get what you are saying :) I need a lot of practice for stuff to stick. When I was learning conditionals and looping, the best advice I got was to start with some practice problems, then make up similar problems with my own data and scenarios. For example, you could write a program to loop through a list of addresses and have it return some information about each entry. Or, you could write a program to take keyboard input and keep printing some result until you enter 'N' (the while loop in action). We were also told to try to solve the problems without using while or for loops to help motivate why you would want them in the first place. That really helped solidify the concepts for me, because you can write code without the loops, but it gets long and tedious... Btw, another link I used was https://www.practicepython.org/ . More on reddit.com
🌐 r/learnpython
6
3
June 9, 2018
Practice Dart - exercises for beginners
Don't forget codingame.com. Also https://da-bootcamp.firebaseapp.com/?course=start_programming_dart More on reddit.com
🌐 r/dartlang
5
42
August 25, 2020
🌐
Pythonista Planet
pythonistaplanet.com › python-while-loop-examples
18 Python while Loop Examples and Exercises – Pythonista Planet
February 2, 2023 - In Python programming, we use while loops to do a task a certain number of times repeatedly. The while loop checks a condition and executes…
🌐
W3Schools
w3schools.com › python › python_while_loops.asp
Python While Loops
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Training ... With the while loop we can execute a set of statements as long as a condition is true.
🌐
BrainStation®
brainstation.io › learn › python › while-loop
Python While Loop (2026 Tutorial & Examples) | BrainStation®
February 4, 2025 - By the end, you will know to loop through a block of code multiple times until the condition remains True. As part of this exercise, your job is to spend money from a piggy bank until there is none left, however, you can only spend $10 at a time. You will have $100 to start with. Each time you spend money, you will print the remaining amount of money left in the piggy bank. Create a variable called piggy_bank_balance and assign it a value of 100 to start with. Write a while loop as follows to spend money and print the remaining balance:
Find elsewhere
🌐
GitHub
github.com › Asabeneh › 30-Days-Of-Python › blob › master › 10_Day_Loops › 10_loops.md
30-Days-Of-Python/10_Day_Loops/10_loops.md at master · Asabeneh/30-Days-Of-Python
Iterate 10 to 0 using for loop, do the same using while loop. Write a loop that makes seven calls to print(), so we get on the output the following triangle: ... # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ... 0 x 0 = 0 1 x 1 = 1 2 x 2 = 4 3 x 3 = 9 4 x 4 = 16 5 x 5 = 25 6 x 6 = 36 7 x 7 = 49 8 x 8 = 64 9 x 9 = 81 10 x 10 = 100 · Iterate through the list, ['Python', 'Numpy','Pandas','Django', 'Flask'] using a for loop and print out the items.
Author   Asabeneh
🌐
HolyPython
holypython.com › home › intermediate python exercises › exercise 9: while loop
Improve your Python skills with Exercise 9: While Loop | HolyPython.com
April 4, 2024 - ... Using a while loop, len function, an if statement and the str() function; iterate through the given list and if there is a 100, assign a notification message to the variable my_message with the index of 100.
🌐
Teclado
teclado.com › 30-days-of-python › python-30-day-8-while-loops
Day 8: While Loops | Teclado
When we want to specify an infinite loop, we want to write an expression which is always going to be evaluate to a truthy value. A good example is the Boolean value, True, which is always going to evaluate to True if we test its truth value. I don't recommend you run this code, but we could write something like this: ... What's going to happen here, is Python is going to very quickly run many iterations of this loop, and we're going to end up with a constant stream of "Hello there!" printed to the console.
🌐
Python Lobby
pythonlobby.com › home › python loop exercises with solution – for loop(), while loop() etc.
Python Loop Exercises with Solution – for loop(), while loop() etc.
October 9, 2022 - # Reverse a number n = int(input("Enter number: ")) rev = 0 while(n != 0): rem = n % 10 rev = rev * 10 + rem n = n // 10 print(rev) # output # 12534
🌐
Python Basics
pythonbasics.org › home › python basics › python "while" loops (indefinite iteration)
Python "while" Loops (Indefinite Iteration) - pythonbasics.org
PyChallenge has 200+ interactive exercises from beginner to interview prep. A while loop repeats a block of code as long as a condition is True. A for loop iterates over a known sequence. A while loop runs until a condition becomes False. Use a break statement or ensure the condition eventually ...
🌐
Proficientpython
proficientpython.com › 2-loops-&-lists › 2-exercise-while-loops.html
Proficient Python: Exercise: While loops
def product_of_numbers(end): """Returns the product of all the numbers from 1 to the end number, including the end number. >>> product_of_numbers(1) 1 >>> product_of_numbers(2) 2 >>> product_of_numbers(3) 6 >>> product_of_numbers(10) 3628800 """ result = 1 counter = 0 while counter < end: result *= counter counter += 2 return result
🌐
LearnPython.com
learnpython.com › blog › python-loop-exercises
10 Python Loop Exercises with Solutions | LearnPython.com
January 29, 2024 - Notice that the loop prints the values until 10 – that is, one less than the stop value. Since you’ll be printing things all the time in Python, check out How to Print in Python – A Detailed Guide for Beginners. This function can do more than you think. Try the above exercise using a while ...
🌐
W3Schools
w3schools.com › python › python_challenges_while_loops.asp
Python While Loops Code Challenge
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Training ... Test your understanding of Python while loops by completing a small coding challenge.
🌐
Pythontutorials
pythontutorials.eu › basic › loops
Loops: for and while // Python Tutorials
You can also loop through a str, ... out each character on a separate line. After the loop, print out 'Done!' ... A while loop executes a code block until a particular condition is no longer True....
🌐
Python Course
python-course.eu › python-tutorial › loops.php
19. While Loops | Python Tutorial | python-course.eu
November 8, 2023 - Chapter on loops with simple and practical examples using while loops in Python.
🌐
CliffsNotes
cliffsnotes.com › home › computer science
Mastering Python While Loops: Exercises for Beginners - CliffsNotes
November 8, 2024 - • It is important to ensure that the loop will eventually stop, or it will create an infinite loop. Exercises Exercise 1: Counting with a While Loop Objective : Write a Python program that uses a while loop to count and display numbers within a specified range.
🌐
Tutorials
zframez.com › tutorials › chapter 6: python while and for loops: examples and explanations
Chapter 6: Python While and For Loops: Examples and Explanations - Tutorials
October 16, 2024 - Learn how to use while and for loops in Python with practical examples. This tutorial covers while loops, else with while loops, for loops, and the range function.