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 ▸

Write a function that takes an imput (call it usr_in), the user's age (usr_age) and the user's name (usr_nm) and outputs the following string: "Hi, My name is [usr_nm], I am [usr_age] years old, and my favorite number is [usr_in]"


Write a python function that takes a string as parameter and returns the character in the string with the most occurrences, along with the number of times this character occurs


What is the difference between a list and an array?


How do I use format python code?