the for loop takes collection of items and executes block of code once for each item in the collection in contrastthe while loop runs as long asor whilea certain condition is true the while loop in action you can use while loop to count up through series of numbers for examplethe following while loop counts from to counting py current_number while current_number < print(current_numbercurrent_number + in the first linewe start counting from by setting the value of current_number to the while loop is then set to keep running as long as the value of current_number is less than or equal to the code inside the loop prints the value of current_number and then adds to that value with current_number + (the +operator is shorthand for current_number current_number python repeats the loop as long as the condition current_number < is true because is less than python prints and then adds making the current number because is less than python prints and adds againmaking the current number and so on once the value of current_number is greater than the loop stops running and the program ends the programs you use every day most likely contain while loops for examplea game needs while loop to keep running as long as you want to keep playingand so it can stop running as soon as you ask it to quit programs wouldn' be fun to use if they stopped running before we told them to or kept running even after we wanted to quitso while loops are quite useful letting the user choose when to quit we can make the parrot py program run as long as the user wants by putting most of the program inside while loop we'll define quit value and then keep the program running as long as the user has not entered the quit valueparrot py prompt "\ntell me somethingand will repeat it back to you:prompt +"\nenter 'quitto end the program