Python Practice Set-1: 10 Exercises (For Python Loops)
2 min readMar 1, 2023
10 Exercises For Python Loops practice
- Using a while loop, write a program that repeatedly asks the user for their name and only exits the loop when the user enters “done”.
- Using a for loop, write a program that prints out the first 20 numbers of the Fibonacci sequence.
- Using a while loop, write a program that repeatedly asks the user for a number and only exits the loop when the user enters a number greater than 100.
- Using a while loop, write a program that repeatedly asks the user for their favorite color and only exits the loop when the user enters “green”.
- Using a for loop, write a program that calculates the factorial of a number given by the user.
- Using a for loop, write a program that prints out all the prime numbers between 1 and 100.
- Using a for loop, write a program that iterates through a list of words and prints out the length of each word.
- Using a for loop, write a program that calculates the average of a list of numbers.
- Using a for loop, write a program that sums up all the integers from 1 to 100.
- Using a for loop, write a program that prints out the elements of a list in reverse order.
Solution :- https://tiny-isthmus-d13.notion.site/Loop-Practice-15fb0ecf1a704ff0bb032f59c1b91aa0