[go: up one dir, main page]

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

Ishaq - ForLoop Worksheet

The document is a worksheet for a Computer Science class focusing on Python iterative statements, specifically the for loop. It contains a list of 20 programming tasks for students to complete, including printing numbers, calculating sums, and generating patterns. The tasks are designed to enhance students' understanding and application of for loops in Python programming.
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)
3 views2 pages

Ishaq - ForLoop Worksheet

The document is a worksheet for a Computer Science class focusing on Python iterative statements, specifically the for loop. It contains a list of 20 programming tasks for students to complete, including printing numbers, calculating sums, and generating patterns. The tasks are designed to enhance students' understanding and application of for loops in Python programming.
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
You are on page 1/ 2

Ziel Classes May 23, 2025

Worksheet
Computer Science
Instructor: Bhaswar Sir
Topic: Python Iterative Statements- For Loop

Write the following programs in Python

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:

*
**
***
****
*****

10. Create a Python program to reverse a string using a for loop.


11. Write a program that prints the Fibonacci series up to n terms using a for
loop.
12. Create a program to find the largest number in a list using a for loop (no
built-in max function).
13. Write a Python program to count how many times a particular element
appears in a list using a for loop.
14. Create a program that prints numbers divisible by both 3 and 5 between 1
and 100.
15. Write a Python program to print a pattern of numbers:

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

You might also like