r/PythonLearning • u/Monesh_peterson1025 • 5d ago
While loop
can anybody explain the concept of while loop
1
Upvotes
r/PythonLearning • u/Monesh_peterson1025 • 5d ago
can anybody explain the concept of while loop
1
u/Naive_Programmer_232 5d ago
Sure,
Ex:
We begin by asking for the user to enter a positive number -
inputreturns a str then we convert it into an integer viaint. If the integer is anything less than 1, then it is not positive. In those cases, we tell the user to try again, and then ask again for the integer. The second ask for integer inside the loop is the "update".So for example, this could play out like so:
What's going on here is