Ishaq - ForLoop Worksheet
Ishaq - ForLoop Worksheet
Worksheet
Computer Science
Instructor: Bhaswar Sir
Topic: Python Iterative Statements- For Loop
1. Write a Python program to print all numbers from 1 to 10 using a for loop.
2. Create a program to print the multiplication table of a number entered by
the user (e.g., 5 × 1 = 5 . . . up to 10).
3. Write a Python program to print all even numbers between 1 and 50 using
a for loop.
4. Develop a program that calculates the sum of all numbers from 1 to n,
where n is entered by the user.
5. Write a program to print the square of each number from 1 to 10.
6. Create a program that prints each character of a string on a new line using
a for loop.
7. Write a Python program to count the number of vowels in a given string
using a for loop.
8. Develop a program to find the factorial of a number using a for loop.
9. Write a program to print a right-angled triangle pattern of stars:
*
**
***
****
*****
1
12
123
1234
16. Write a Python program that takes a list of names and prints only those
starting with a vowel using a for loop.
17. Create a program to calculate the average of numbers entered by the user,
using a for loop for repeated input.
18. Write a Python program to display only the prime numbers between 1 and
50 using a for loop.
19. Create a program to print the ASCII value of each character in a user-
entered string.
20. Write a Python program that generates and prints the first 10 powers of 2
using a for loop.
Page 2