Python Practice Set: Loops
This practice set focuses on using for and while loops in Python. Try solving each problem on your own before
checking solutions.
Easy Level
1
2
3
4
5
6
7
Write a program to print numbers from 1 to 10 using a for loop.
Print all even numbers between 1 and 20.
Write a program to print the first 10 natural numbers using a while loop.
Print the multiplication table of 5.
Write a program to calculate the sum of numbers from 1 to 50.
Print each character of a given string using a loop.
Write a program to print numbers from 10 to 1 in reverse order.
Medium Level
1
2
3
4
5
6
7
Write a program to find the factorial of a number using a loop.
Print all numbers between 1 and 100 that are divisible by both 3 and 5.
Write a program to count the number of digits in a given number.
Generate the Fibonacci series up to n terms.
Write a program to reverse a given number using a loop.
Print the following pattern using loops:
1
22
333
4444
Write a program to find the sum of all digits of a number.
Hard Level
1
2
3
4
5
6
Write a program to check whether a given number is a prime number.
Print all prime numbers between 1 and 100.
Write a program to check whether a number is an Armstrong number.
Create a number guessing game using a while loop.
Write a program to find the greatest common divisor (GCD) of two numbers using loops.
Print the following pattern:
*
**
***
****