do {} while () in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

do {} while () in python

How can i replace do {} while () in C++ for Python3?

17th Aug 2018, 10:31 AM
Denys Denysuik
4 Answers
+ 7
Try a 'while' loop with a 'if' to bail out from, probably something like this: while True: # whatever you want here if some_condition: break
17th Aug 2018, 11:15 AM
Ipang
+ 3
You're welcome, glad if it helps : )
17th Aug 2018, 12:00 PM
Ipang
+ 2
Thank you.
17th Aug 2018, 11:23 AM
Denys Denysuik
0
or dont use "while True:" and use "while X:" # X = loop condition
17th Aug 2018, 2:24 PM
Markus Kaleton
Markus Kaleton - avatar