Python) while, break

When you repeat and get the output of the same sentence over and over to the point you set, you use ‘while’ rather than ‘if’

example while

This example gets outputs of 1, 2 .. up to 9 because if a reach the number of 10, it stops since it is not smaller than 10 that I set for while

This shows that ‘while’ runs forever until python thinks it is false

__________________________________________________________________

Since python will loop over and over to when the statement is recognized as not true, thus there will be a situation when you want to stop the loop

There are several ways to stop the loop, like changing the statement, but the easy way is to use ‘break’