Is there an inherent do-while loop in Python?
Answers were Sorted based on User's Feedback
Answer / nashiinformaticssolutions
12. Is there an inherent do-while loop in Python?
Python does not have a built-in `do-while` loop. However, you can simulate it using a `while` loop with a condition that ensures the loop runs at least once.
Example:
python
while True:
# code to run
if not condition:
break
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / glibwaresoftsolutions
Python does not have a built-in `do-while` loop. However, you can simulate it using a `while` loop with a condition that ensures the loop runs at least once.
Example:
python
while True:
# code to run
if not condition:
break
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the difference between list and tuples?
How to convert string into datetime?
Can we use Python in HTML?
What is the shortest method to open a text file and display its content?
How to get the current time in python?
What is purpose of __init__ in class ? Is it necessary to use __init__ while creating a class ?
What is the difference between `__str__` and `__repr__` methods in Python?
what's wrong with import all?
What does it mean if something is static?
Explain about the dictionary function in python?
Does python have private?
What is the use of negative indexes?