🌐
CS-IP-Learning-Hub
csiplearninghub.com › questions-of-while-loop-in-python
40 Important Questions of While loop in Python (Solved) Class 11 - CS-IP-Learning-Hub
January 15, 2023 - Ans. num = 2 sum = 0 while num <= 20: sum = sum + num num= num + 2 print(sum) ... Ans. i = 1 num = int(input("Enter any number : ")) while i <= 10: print(num," * ",i," = ", num * i) i = i+1 OUTPUT : Enter any number : 5 5 * 1 = 5 5 * 2 = 10 ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-while-loop
Python While Loop - GeeksforGeeks
When execution leaves a scope, all automatic objects that were created in that scope are destroyed. Python supports the following control statements. Python Continue Statement returns the control to the beginning of the loop. ... # Prints all letters except 'e' and 's' i = 0 a = 'geeksforgeeks' while i < len(a): if a[i] == 'e' or a[i] == 's': i += 1 continue print(a[i]) i += 1
Published   December 23, 2025
Discussions

Looking for practice while loop questions
I just went through a whole bunch of for loop exercises and I feel like I have a good understanding of it but I’m having a hard time finding practice while loop problems. Any good links to sites with specifically while loop exercises with solutions? All I’ve found bunches for loop and while ... More on discuss.python.org
🌐 discuss.python.org
0
0
February 3, 2023
Beginner question about While Loops
Forget about the while and just imagine number = int(input()) number = number - 1 print(number) Do you see? More on reddit.com
🌐 r/learnpython
12
3
September 8, 2023
Questions about For loops in Python
  • use enumerate()

https://stackoverflow.com/questions/522563/accessing-the-index-in-python-for-loops

  • use range()

https://stackoverflow.com/questions/2990121/how-do-i-loop-through-a-list-by-twos

More on reddit.com
🌐 r/learnprogramming
4
3
June 11, 2014
Struggling with Python - can someone explain how ‘for loops’ work in simple terms? 🐍👩‍💻
Say you have a list, my_list = [1, 3, 5, 8] and all you want to do is print it. You would iterate over each item in the list, and print it. So FOR each item, you will print it individually. for item in my_list: print(item) Note that item is a variable assigned when you make the for loop. It could be anything. for x in my_list: print(x) for _ in my_list: print(_) These do the same things. You can also loop through the range using the index for i in range(len(my_list)): print(my_list[i]) Again, i could be anything. It's just the name you are assigning to the current item being iterated. So the basic structure is for thing in bunch_of_things: do_stuff_to(thing) Hope this helps! I am also learning, so someone else may be able to break it down a little better. More on reddit.com
🌐 r/learnpython
85
125
November 17, 2023
🌐
Vista Academy
thevistaacademy.com › home › blog › some important questions of while loop in python to practice (with answers)
20+ While Loop Questions in Python (With Answers & Practice Problems)
August 3, 2025 - Practice key while loop questions in Python with answers. Includes syntax errors, indefinite loops, execution count, and beginner-friendly examples.
🌐
Real Python
realpython.com › quizzes › python-while-loop
Python while Loops: Repeating Tasks Conditionally Quiz – Real Python
If the condition is true, then the loop executes. Otherwise, it terminates. The quiz contains 11 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the quiz, you’ll receive a total score.
🌐
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 - Refer to the following tutorials ... loop with range(), we can repeat an action a specific number of times. while loop: To execute a code block repeatedly, as long as the condition is True....
🌐
Python.org
discuss.python.org › python help
Looking for practice while loop questions - Python Help - Discussions on Python.org
February 3, 2023 - I just went through a whole bunch of for loop exercises and I feel like I have a good understanding of it but I’m having a hard time finding practice while loop problems. Any good links to sites with specifically while loop exercises with solutions? All I’ve found bunches for loop and while ...
🌐
W3Schools
w3schools.com › python › exercise.asp
Exercise: - Python While Loops
Inner Class3 q · File Handling3 q · Open File3 q · Write to File3 q · Remove File3 q by w3schools.com · Next Question » · Try Again · You have already completed these exercises! Do you want to take them again? Yes No · × · Close the exercise · You completed the Python While Loops Exercises from W3Schools.com ·
🌐
GeeksforGeeks
geeksforgeeks.org › quizzes › python-while-loop-quiz
Quiz about Python While Loop Quiz
Use a for loop instead. Use the range function with the length of the list. Convert the list to a set and iterate over it. Use the enumerate function. ... Only if the dictionary keys are integers. Only if the dictionary has a single key. ... In Python, how can you emulate the behavior of a break statement inside a while loop without using bre
Find elsewhere
🌐
CodeChef
codechef.com › learn › course › python › LTCPY17 › problems › PYTHCL107
While Loop in Python Programming
Test your Learn Python Programming knowledge with our While Loop practice problem. Dive into the world of python challenges at CodeChef.
🌐
Programiz
programiz.com › python-programming › while-loop
Python while Loop (With Examples)
Here, the condition of the while loop is always True. However, if the user enters end, the loop termiantes because of the break statement. ... In Python, a while loop can have an optional else clause - that is executed once the loop condition is False.
🌐
LinkedIn
linkedin.com › pulse › 25-python-loop-coding-questions-mrityunjay-pathak
25 Python Loop Coding Questions
August 4, 2023 - Explanation: The while loop iterates from 1 to 100, adding each number to the sum_numbers variable. Find all prime numbers between 1 and 50 using nested for and if: for num in range(2, 51): for i in range(2, num): if num % i == 0: break else: ...
🌐
Pythonista Planet
pythonistaplanet.com › python-while-loop-examples
18 Python while Loop Examples and Exercises – Pythonista Planet
February 2, 2023 - On this site, I share everything that I've learned about computer programming. I am looking for a way to take user inputs in while loop & compare it & print the smallest/largest value.
🌐
Mkzia
mkzia.github.io › eas503-book › chapters › 06 › while_loop_exercises.html
6.3. While Loop Exercises — EAS503: Python for Data Scientists
Enter nothing to quit: ')) average = summed_values / number_count print('The average of %d numbers is %f' %(number_count, summed_values)) Write a program that takes test grades from the user and returns their average and the letter grade of the average.Use a while loop and make negative ...
🌐
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
In the above while loop, the condition becomes false when count is 5. That is when the loop stops. If we are interested to run block of code once the condition is no longer true, we can use else. # syntax while condition: code goes here else: code goes here
Author   Asabeneh
🌐
learnpython4cbse
learnpython4cbse.com › mcq-comp-sc-xii-10 › python-mcq---for-and-while-loops-1
Python MCQ - for and while loops-1
This quiz consists of 20 questions and it is carefully designed to help you self-assess your comprehension of the information presented on the topic for and while loop in Python.
🌐
W3Schools
w3schools.com › python › python_while_loops.asp
Python While 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 ... With the while loop we can execute a set of statements as long as a condition is true.
🌐
Berkeley
pythonnumericalmethods.studentorg.berkeley.edu › notebooks › chapter05.02-While-Loops.html
While Loops — Python Numerical Methods
Python computes n >= 1 or 0.5 >= 1, which is false so the while-loop ends with i = 4. You may have asked, “What if the logical expression is true and never changes?” and this is indeed a very good question. If the logical expression is true, and nothing in the while-loop code changes the ...
🌐
Analytics Vidhya
analyticsvidhya.com › home › all about python while loop with examples
Python While Loop with Examples and Use Cases
January 31, 2024 - In this example, we initialize the variable `num` to 1. The while loop continues if `num` is less than or equal to 5. Inside the loop, we print the value of `num` and then increment it by 1 using the `+=` operator. This process repeats until `num` becomes 6, when the condition becomes False, and the loop terminates. Python provides three loop control statements, ‘ break’, ‘ continue’, and’ pass, ‘ to allow you to control the flow of a while loop.