New course! Every coder should learn Generative AI!
Try a free lesson+ 3
Many basic tasks are much easier to be done with for loops, but there is a few uses with while loops too.
You can make "infinite loops".
For example if you are asking for a value, (does not work on SoloLearn Python playground.) if user gives a wrong value, you can make the program ask the user to give the wanted values as many times until user gives a valid value, which would then break the "infinite loop".
These "infinite loops" are also useful for some graphical packages, such as Pygame, where games are actually ran in a loop. (For many other graphical packages this looping can be done differently.)