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 if else, for loop, and range() exercises with solutions
Python if else, for loop, and range() Exercises with Solutions
April 19, 2025 - This Python loop exercise contains 22 different coding questions, programs, and challenges to solve using if-else conditions, for loops, the range() function, and while loops.
🌐
LearnPython.com
learnpython.com › blog › python-loop-exercises
10 Python Loop Exercises with Solutions | LearnPython.com
January 29, 2024 - A great way for beginners to learn Python is by doing hands-on exercises. In this article, you’ll get 10 Python exercises for writing loops. You’ll also get the solutions with detailed explanations.
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 31, 2018
Python loop exercise help
Hi, I am new to coding. Why does my code still slice the list when it gets to 11, despite it being an odd number? The function should be removing any even number from the front of the list Intended output should be [11, 12, 15] def delete_starting_evens(my_list): while len(my_list) > 0: for ... More on discuss.python.org
🌐 discuss.python.org
0
0
March 24, 2024
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
December 14, 2016
Python exercises to practice skills

Nice thank you

More on reddit.com
🌐 r/learnpython
12
147
May 16, 2015
🌐
Scaleway
scaleway.com › en › docs › tutorials › python-for-loops
Getting started with Python for loops | Scaleway Documentation
July 28, 2025 - As we saw in an earlier example we can use loops with Python's built-in range() function to state exactly how many times we want the loop to iterate. ... With just one parameter, the range starts at a default of 0 and finishes at (not including) the specified number: ... With three parameters, we set the start and finish numbers of the range, and the step value (the interval between each iteration): for x in range(2, 10, 2): print(x) ## Output: 2 4 6 8
🌐
w3resource
w3resource.com › python-exercises › python-conditional-statements-and-loop-exercises.php
Python conditional statements and loops - Exercises, Practice, Solution - w3resource
For numbers that are multiples of three and five, print "FizzBuzz". ... Write a Python program that takes two digits m (row) and n (column) as input and generates a two-dimensional array.
🌐
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
for number in range(11): print(number) # prints 0 to 10, not including 11 else: print('The loop stops at', number) In python when statement is required (after semicolon), but we don't like to execute any code there, we can write the word pass to avoid errors. Also we can use it as a placeholder, for future statements. ... 🌕 You established a big milestone, you are unstoppable. Keep going! You have just completed day 10 challenges and you are 10 steps a head in to your way to greatness. Now do some exercises for your brain and muscles.
Author   Asabeneh
🌐
Python Course
python-course.eu › python-tutorial › for-loops.php
20. For Loops | Python Tutorial | python-course.eu
Write a program to find and print all prime numbers between 1 and 50 using a for loop. Print numbers from 1 to 42, but for multiples of 3, print "Fizz," and for multiples of 5, print "Buzz." For numbers that are multiples of both 3 and 5, print "FizzBuzz." This exercise is about the Ramanujan-Hardy ...
🌐
W3Schools
w3schools.com › python › python_for_loops.asp
Python For Loops
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Certificate Python Training ... A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).
Find elsewhere
🌐
Mkzia
mkzia.github.io › eas503-book › chapters › 06 › for_loop_exercises.html
6.2. For Loop Exercises — EAS503: Python for Data Scientists
def average_from_file(filename): grade_list = [] with open(filename) as file: for line in file: if line.strip(): try: grade_list.append(float(line)) except ValueError: print('Bad value: ', line) return sum(grade_list) / len(grade_list) print(average_from_file('for_ex7_data1.txt'))
🌐
HolyPython
holypython.com › home › intermediate python exercises › exercise 8: for loop
Improve your Python skills with Exercise 8: For Loop | HolyPython.com
April 4, 2024 - Write a for loop that iterates through a string and prints every letter. ... When you iterate through a string it will go through the letters as strings have indexing too. ... Check out Holy Python AI+ for amazing Python learning tools.
🌐
Python Basics
pythonbasics.org › for-loops
Python "for" Loops (Iteration Introduction) - Python Tutorial
In the exercise below we will repeat actions on every item of a list. The first loop will repeat the print functionfor every item of the list. The second loop will do a calculation on every element of the list num and print the result. Type the code below and run the program. Save the file as loopexample.py Then run the code with the command: ... If you are a beginner, then I highly recommend this book. ... 2. Create a loop that counts from 0 to 100 3.
🌐
Pythontutorials
pythontutorials.eu › basic › loops
Loops: for and while // Python Tutorials
Use range() to count down from 4 to 0. Use enumerate() to create another counter that goes for 0 to 4. Print each pair of numbers out on a separate line in this format: '0 4', etc. (I.e. the result is the same as for the previous mini exercise, but the implementation is different.)
🌐
Pythonista Planet
pythonistaplanet.com › python-for-loop-examples
21 Python for Loop Exercises and Examples – Pythonista Planet
May 26, 2022 - # printing multiples of 5 till 20 for i in range(5,20,5): print(i) ... I hope this article was helpful. Check out my post on 18 Python while Loop Examples.
🌐
Python.org
discuss.python.org › python help
Python loop exercise help - Python Help - Discussions on Python.org
March 24, 2024 - Hi, I am new to coding. Why does my code still slice the list when it gets to 11, despite it being an odd number? The function should be removing any even number from the front of the list Intended output should be [11, 12, 15] def delete_starting_evens(my_list): while len(my_list) > 0: for num in my_list: if num % 2 == 0: my_list = my_list[1:] else: my_list[0:] return my_list print(delete_starting_evens([4, 8, 10, 11, 12, 15])) Output: [12, 15]
🌐
TechBeamers
techbeamers.com › python-exercises-on-loops-conditions-range
Python Control Flow Exercises - TechBeamers
April 18, 2025 - Here are 45 Python exercises on loops (for, while), if-else statements, and the range() function, along with their solutions. Each exercise comes with a brief description of the problem and a solution…
🌐
Llego
llego.dev › home › blog › practical exercises for learning loops in python
Practical Exercises for Learning Loops in Python - llego.dev
May 28, 2023 - These examples demonstrate how for loops work consistently across different sequence data types in Python. Generate a sequence of numbers using Python’s range() function: ... Prints numbers 0 through 4. ... Prints numbers 3 to 7. Omitting the step size defaults to increments of 1. ... Prints odd numbers from 1 to 9. ... These exercises demonstrate how to construct ranges for iteration in for loops.
🌐
Exercism
exercism.org › tracks › python › concepts › loops
Loops in Python on Exercism
Master Loops in Python by solving 92 exercises, with support from our world-class team.