📚 › Python: the friendliest first language
9. while loops
A while loop repeats as long as its condition is True. Change the variable inside the loop, or the loop never stops.
Use while when you do not know in advance how many times to repeat.
Show example
count = 1
while count <= 3:
print(count)
count += 1
✍️ Your turn
Use a while loop to print 2, 4, 6 on separate lines, starting with n = 2.