do-while

Why there is no do while loop in python

Why there is no do while loop in python Question: Why doesn’t Python have a ‘do while’ loop like many other programming language, such as C? Example : In the C we have do while loop as below : do { statement(s); } while( condition ); Asked By: Bahubali Patil || Source Answers: There is …

Total answers: 2

How to emulate a do-while loop?

How to emulate a do-while loop? Question: I need to emulate a do-while loop in a Python program. Unfortunately, the following straightforward code does not work: list_of_ints = [ 1, 2, 3 ] iterator = list_of_ints.__iter__() element = None while True: if element: print element try: element = iterator.next() except StopIteration: break print “done” Instead …

Total answers: 20