microsoft / c9-python-getting-started

Sample code for Channel 9 Python for Beginners course
MIT License
7.75k stars 2.25k forks source link

A small code that could be used as Do While Loop. #8

Closed shoaibrayeen closed 4 years ago

shoaibrayeen commented 4 years ago

for and while is used when you need to check the termination condition and then use it.

do while is used when you need to use it and then check the termination condition.

The above program is a small code to make you understand how to do it.

''' Print [ 0 , 3] works as do while - Since there's no do while in Python - You could use it like this. It uses i and then increment it and then compare it with termination condition. and prints - 0 1 2 3 '''