The way i see it is while loops work like if statements but in a loop. Lets just think about it, if statements need a condition to run the code in its scope, a while loop only runs the code in its scope if the condition is true, in this case i did a while True, this would technically run for forever and not stop but i put a break in which stops as soon as reaches this point, in the next loop i added a condition which, but in the scope i am removing 1 from x, which eventually then will make the condition false which then stops the while loop cause the condition is false.
1
5 reads
IDEAS CURATED BY
Keep reading, keep studying, the more you learn the more you change. If you are doing the Python lessons please join this discord channel https://discord.gg/kugXx9KY but please follow the rules
CURATOR'S NOTE
this will explain a little about while loops
“
Similar ideas
11 ideas
4 ideas
Read & Learn
20x Faster
without
deepstash
with
deepstash
with
deepstash
Personalized microlearning
—
100+ Learning Journeys
—
Access to 200,000+ ideas
—
Access to the mobile app
—
Unlimited idea saving
—
—
Unlimited history
—
—
Unlimited listening to ideas
—
—
Downloading & offline access
—
—
Supercharge your mind with one idea per day
Enter your email and spend 1 minute every day to learn something new.
I agree to receive email updates