I wanted to know if the following function, written in pseudocode, exists in the Python language:
repeat
(commands)
to (condition);
Thank you.
I wanted to know if the following function, written in pseudocode, exists in the Python language:
repeat
(commands)
to (condition);
Thank you.
You can use while
like this:
contador = 0
while (contador < 9):
print ('O contador é:', contador)
contador = contador + 1
In this way it checks to see if the contador < 9
condition is still valid and runs inside the while
if it is true.
If you want to do the style do
/ while
(do an action and check at the end) you could do this:
contador = 0
while True:
print ('O contador é:', contador)
contador = contador + 1
if not contador < 9:
break