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

Python 2 Nov 2023

Uploaded by

newcartoonworld1
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)
13 views

Python 2 Nov 2023

Uploaded by

newcartoonworld1
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/ 1

DATE (2-11-2023)

PRACTICE QUESTIONS ON FOR and WHILE LOOP


1. Write a Python program that uses a for loop to print the numbers from 1 to 10.
2. Write a Python program to print all the even numbers from 1 to 20 using a for loop.
3. Create a while loop that counts from 1 to 10 and prints the numbers.
4. Write a Python program that calculates the sum of all numbers from 1 to 30 using a for loop.
5. Create a program that asks the user to enter a number and uses a while loop to find and print
the sum of all numbers from 1 to that number.
6. Using a for loop, print the first 10 multiples of 5.
7. Create a while loop that asks the user to enter a number and keep asking until the user enters
the number 7.
8. Use a while loop to find and print the factorial of a user-entered number.
9. Write a Python program that prints the reverse of a user-entered string using a for loop.
10. Write a Python program that uses a while loop to check if a user-entered number is prime or
not.
11. Write a Python program that prints the Fibonacci sequence up to the 10th term using a for
loop.

You might also like