#What would be good alternative of 'Repeat-Until loop' in Python?

7 messages · Page 1 of 1 (latest)

hearty fulcrum
#

Fyi, we are given 'structured' pseudocode guidelines in Alevel, this is done in year 12.
We get tested with our Python skills in year 13, where I have 0 knowledge currently.
My CS teacher shared a doc that shows pseudocode equivalent to Python.

and I found that 'Repeat- Until loop' (post-condition loop) is NOT possible in python.
so my question is , how would you guys make post condition loop in Python?

#

I'm just a student btw

stone horizon
#

while True:

do stuff

if condition:
break

#

(tbf I've never seen a do-while loop in real life)

strange arrow
#

In this case I’d do

count = 0
while count <= 100:
    …

Just need to flip the condition from greater than to less than or equal

stone horizon
#

do while does the check after the first execution of the body