May 2017
Intermediate to advanced
280 pages
6h 2m
English
So far we learned about definite loop, now we will understand what is an indefinite loop? Indefinite loop is a loop that will continue to run infinite number of times until and unless it is asked to stop. In order to execute an indefinite loop, we use the while statement.
while <condition>: <statements>
This loop will continue to execute until the condition is met and will terminate once the condition is not met. Let's try to understand with an example:
checking_acc = 5678143 num = int(raw_input("Enter the account numbert")) while checking_acc != num: print "Wrong number " num = int(raw_input("Enter the right account numbert")) print "n*********" print "Your account number is" , num
Here, we are interested to validate ...
Read now
Unlock full access