Python Loop Questions
1. Print numbers from 1 to 100 using a for loop.
2. Print numbers from 100 to 1 using a while loop.
3. Print all even numbers between 1 and 100.
4. Print all odd numbers between 1 and 100.
5. Find the sum of numbers from 1 to N.
6. Find the product of numbers from 1 to N.
7. Print the multiplication table of a given number.
8. Print the cubes of numbers from 1 to 20.
9. Count how many numbers are divisible by 7 between 1 and 100.
10. Print all multiples of 5 between 1 and 200.
11. Find the factorial of a number.
12. Count the number of digits in a given number.
13. Find the sum of digits of a number.
14. Find the product of digits of a number.
15. Reverse a number.
16. Check whether a number is a palindrome.
17. Find the largest digit in a number.
18. Find the smallest digit in a number.
19. Calculate the average of digits in a number.
20. Count the occurrences of a specific digit in a number.
21. Check whether a number is prime.
22. Print all prime numbers between 1 and 100.
23. Print all prime numbers between two user-given numbers.
24. Count the total prime numbers between 1 and N.
25. Find the sum of all prime numbers between 1 and N.
26. Generate the Fibonacci series up to N terms.
27. Check whether a number is an Armstrong number.
28. Print all Armstrong numbers between 1 and 1000.
29. Create a menu-driven calculator using an infinite while loop.
30. Create a number guessing game using a while loop that continues until the correct number is
guessed.
31. Find the GCD (HCF) of two numbers using loops.
32. Find the LCM of two numbers using loops.
33. Check whether a number is a Perfect Number.
34. Print all Perfect Numbers between 1 and 10,000.
35. Convert a decimal number to binary using loops.
36. Convert a binary number to decimal using loops.
37. Find all factors of a number.
38. Count the total factors of a number.
39. Check whether two numbers are co-prime.
40. Find the second largest digit in a number.