while if mod break

While loop keeps going If condition is not met Break out and be free

python shell for while if mod break

While I loop and loop
If condition is met, break
Modulo gives rest

I was just learning about the while loop in Python, and I found out that it’s really useful for repeating a block of code as long as a certain condition is true. I also learned about the if statement, which allows me to execute a block of code only if a certain condition is met. The modulo operator (%) also came up, and I discovered that it gives me the remainder of a division operation. This is really handy for checking if a number is even or odd. Lastly, I learned about the break statement, which allows me to exit a loop prematurely if a certain condition is met. It’s a great way to stop a loop from running indefinitely.