What is the difference between a for loop and a while loop?

A for loop will run the code a predetermined number of times, whereas a while loop will continue to execute the code until a predetermined condition is met.

MI

Related Python Mentoring answers

All answers ▸

What is the difference between a float and an integer variable type?


How can you take a list of numbers and add 3 to every number in the list using only one line of code?


Why are negative indexes used?


Sales is real Customers is integer startmainprog input Sales input Customers if ((Sales > 500) OR ((Sales > 300) AND (Customers>9))) then output “Bonus Awarded” else output “No Bonus” end if end subroutine. Sales = 600 Customers = 9, answer: