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

+18

Does python have do-while loop?

4/14/2021 8:22:54 PM

Anurag Madhesia

13 Answers

New Answer

+23

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

+11

Thank you

+2

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.

+1

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

+1

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

0

pannddorra Really Can you tell me

0

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

0

As the title says. Maybe there is a diffrence between languages, in that case I'm learning C at the moment. https://www.mymilestonecard.run/

0

No it does not have that but it has better

0

0

No, it doesn't.

0

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.

-2