Post

@clcoding Answer: 20 15 (on separate lines)
Solution: Quick recap,
a `while` loop's body is repeatedly executed until
the condition is condition remains truthy.
Here
num = 20
assigns the value 20 to `num`.
while num > 10:
...
This loop will execute as long as num>10
+
English

@clcoding Notice that the inequality is `>`, not `>=`.
So the condition is satisfied only when num is strictly greater than 10.
Currently num is 20, so the condition is satisfied.
Thus the loop executes
print(num)
prints 20 to the output.
num -= 5
deducts 5 from num.
So
+
English

@clcoding num, which was 20, now becomes 15.
That is the end of the loop body.
Hence the loop condition is checked, to determine if the loop is to be run again.
The condition is num>10.
num is 15 so the condition holds True.
Hence the loop executes again
+
English

@clcoding print(num)
prints the value of num, which is now 15, to the output.
The net output so far is
20
15
Now,
num-=5
reduces the value of num by 5.
So, num, which was 15, now reduces to 10.
This is the end of the loop body.
+
English

@clcoding The loop condition is checked, to determine if the loop is to be run again.
the loop condition is
num>10
since the value of num is 10, the strict inequality > is not satisfied.
num>10 comes out to be False.
Hence the loop does not run again.
That's the end of the snippet
+
English

