0% found this document useful (0 votes)
482 views

Python Loop Exercise

This document outlines 10 exercises to practice for and while loops in Python. The exercises include printing numbers from 1 to 10, creating a multiplication table from a user-input number, finding the sum of natural numbers, iterating through a list and printing names, calculating the factorial of a user-input number, printing the Fibonacci series up to a user-specified amount of terms, reversing a user-input number, counting vowels in a string, checking if a user-input number is a palindrome, and calculating the sum of squares from 1 to 5.

Uploaded by

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

Python Loop Exercise

This document outlines 10 exercises to practice for and while loops in Python. The exercises include printing numbers from 1 to 10, creating a multiplication table from a user-input number, finding the sum of natural numbers, iterating through a list and printing names, calculating the factorial of a user-input number, printing the Fibonacci series up to a user-specified amount of terms, reversing a user-input number, counting vowels in a string, checking if a user-input number is a palindrome, and calculating the sum of squares from 1 to 5.

Uploaded by

Rashid Bhai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

PYTHON LOOP EXERCISE

Exercise 1:

Write a program using a for loop to print the numbers from 1 to 10.

Exercise 2:

Create a program that uses a for loop to print the multiplication table of a user-inputted number.

Exercise 3:

Write a program using a while loop to find the sum of natural numbers up to a given number entered
by the user.

Exercise 4:

Create a program that uses a for loop to iterate through a list of names and prints each name.

Exercise 5:

Write a program using a while loop to find the factorial of a user-inputted number.

Exercise 6:

Create a program using a for loop to print the Fibonacci series up to a specified number of terms
entered by the user.

Exercise 7:

Write a program using a while loop to reverse a number entered by the user.

Exercise 8:

Create a program that uses a for loop to iterate through a string and count the number of vowels.

Exercise 9:

Write a program using a while loop to check if a user-inputted number is a palindrome.


Exercise 10:

Create a program using a for loop to calculate and print the sum of the squares of the numbers from 1
to 5.

You might also like