Python Practice Sheet - Loops and Total Calculation
1. Write a Python program to input 5 numbers from the user and calculate their total using a for loop.
2. Write a program to find the total of all even numbers between 1 and 50 using a for loop.
3. Write a program that calculates the total of all numbers divisible by 3 from 1 to 100.
4. Write a program to find the sum of digits of a number entered by the user.
5. Write a Python program that asks the user to enter 10 numbers and calculates the total of only
those numbers which are greater than 50.
6. Write a program that uses a for loop to find the total of all odd numbers between 1 to 100, but skip
the numbers which are divisible by 5 using 'continue'.
7. Write a program that uses a for loop to ask the user to enter 10 numbers, but if the user enters a
negative number, stop asking further using 'break'. Also print the total till that point.
8. Write a program that calculates the total of numbers from 1 to 100, but skip all numbers that are
divisible by both 3 and 5 using continue.
9. Write a program to continuously take numbers from user until user enters 0. Use a for loop with
range(1000) as a trick. Stop on 0 and print total.
10. Write a Python program that asks user to enter marks of 10 students using a for loop. If a
student is absent, enter -1 and skip that entry. If a student scores more than 100, break the loop and
display 'Invalid Entry'. Show the total of valid marks only.