BIT BY BYTE
Question 1 of 2
3 marks
State the difference between a `for` loop and a `while` loop. Give an example of when each is appropriate.
`for` repeats a known number of times (e.g. print 10 stars). `while` repeats until a condition is False (e.g. ask for password until correct).
`for` is faster than `while`
`for` works on lists, `while` works on numbers
`while` can only run once, `for` can run many times
Check Answer