0% found this document useful (0 votes)
64 views2 pages

Python For Loop Practice Questions

The document contains a comprehensive list of Python for loop practice questions categorized into seven levels, ranging from basic to advanced. Each level includes various tasks such as printing numbers, manipulating strings, performing mathematical operations, and working with files. Additionally, there are bonus challenge questions that further test the understanding of loops and conditions.

Uploaded by

extraexpert185
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views2 pages

Python For Loop Practice Questions

The document contains a comprehensive list of Python for loop practice questions categorized into seven levels, ranging from basic to advanced. Each level includes various tasks such as printing numbers, manipulating strings, performing mathematical operations, and working with files. Additionally, there are bonus challenge questions that further test the understanding of loops and conditions.

Uploaded by

extraexpert185
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PYTHON FOR LOOP PRACTICE QUESTIONS (BASIC TO ADVANCED)

LEVEL 1: BASIC FOR LOOP QUESTIONS


1. Print numbers from 1 to 10 using for loop.
2. Print even numbers from 1 to 50.
3. Print numbers in reverse from 10 to 1.
4. Loop through a list: ["apple", "mango", "banana"] → print one item per line.
5. Loop over a string "PYTHON" → print each character.
6. Print multiplication table of a number given by the user.
7. Print squares of numbers from 1 to 10.
8. Print the sum of first 10 natural numbers.
9. Print all odd numbers between 1 to 100.
10. Print factorial of a number using a for loop.

LEVEL 2: INTERMEDIATE QUESTIONS


11. Calculate the sum of all elements in a list.
12. Count vowels in a given string.
13. Print characters of a string without using indexing.
14. Print list elements with their index using enumerate().
15. Print star pattern:
*
**
***
****
16. Reverse star pattern:
****
***
**
*
17. Print all numbers divisible by both 3 and 5 in range(1, 100).
18. Generate Fibonacci series using a for loop.
19. Loop over a dictionary and print keys & values.
20. Convert a list of strings to uppercase using loop.

LEVEL 3: PATTERN QUESTIONS


21. Number pattern:
1
12
123
1234
22. Alphabet pattern:
A
AB
ABC
ABCD
23. Number reverse pattern:
54321
5432
543
54
5
24. Star pyramid:
*
***
*****
*******
25. Hollow square:
*****
**
**
**
*****

LEVEL 4: LIST, STRING & LOOP OPERATIONS


26. Find the largest number in a list (without max()).
27. Count how many times a number appears in a list.
28. Remove duplicates from a list using a loop.
29. Reverse a string using for loop (without slicing).
30. Merge two lists element■wise.

LEVEL 5: FILE & DATA PROCESSING


31. Read a file and print each line using loop.
32. Count number of words in a file.
33. Count frequency of each word.
34. Print only lines that contain a specific word.
35. Read numbers from file and print their sum.

LEVEL 6: ADVANCED PROBLEMS


36. Find prime numbers in a range.
37. Check if a number is Armstrong.
38. Check if a number is Palindrome.
39. Print Pascal's triangle using loops.
40. Print all sublists of a list.

LEVEL 7: LOOP + CONDITIONS + MATH


41. Program to print HCF of two numbers.
42. Program to print LCM using loop.
43. Create multiplication table from 1 to 10 (nested loop).
44. Print matrix elements row■wise using loop.
45. Matrix addition using nested loops.

BONUS: CHALLENGE QUESTIONS


46. Create continuous number triangle:
1
23
456
7 8 9 10
47. Convert a sentence into Title Case without using built■ins.
48. Manually sort numbers without using sort().
49. Implement bubble sort.
50. Count uppercase, lowercase, digit, special characters.

You might also like