Exercises – Loops


Exercise 1

1. Change the following Python code from using a while loop to for loop:

Change the following Python code from a for loop to a while loop:

Exercise 2

Knowing that the correct username is John and the correct password is 123456789, initially open and run several times by entering different values each time the password.py program. Then, erase the solution and try to solve it yourself.

Exercise 3

Write a Python program to calculate the sum and average of n integer numbers (input from the user). Input 0 to finish.

Click the following link to get access to more exercises..