Does python have do-while loop? | Sololearn: Learn to code for FREE!


Does python have do-while loop?

4/14/2021 8:22:54 PM

Anurag Madhesia

13 Answers

New Answer


Python has no do-while-loop. You could emulate it in the following way: while True: stuff() if fail_condition: break


Thank you


A do-while loop is important because it is a post-test loop, meaning that it checks the condition only after executing the code in the loop block. Even though Python doesn't explicitly have the do-while loop , we can emulate it.


Anurag Madhesia Python doesn't have do-while loop.


No buddy no do while , you can use for loop and while loop for looping in python


pannddorra Really Can you tell me


no do-while-loop, but it exist that. while (condition) : instruction 1 instruction 2 ...


As the title says. Maybe there is a diffrence between languages, in that case I'm learning C at the moment.


No it does not have that but it has better



No, it doesn't.


Why there is not do...while loop in Python? PEP 315 (Python Enhancement Proposal) to include do..while statement has been rejected because it doen't fit in the general format of indented block statement: indented block used by every other Python compound statement. In words of Guido Van Rossum - "Please reject the PEP.