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 ▸

Define a function that takes in the age of the user and adds it to an output sentence such as "You are ..... old".


Write a simple number guessing game, give the user 3 tries to guess a number between 1 and 10


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


What are recursive functions and when should they be used?