Building on this example and others found elsewhere we have two types of loops, definite and indefinite:
definite being a loop that has its number of iterations known before it is executed. E.g. a for loop:
for x in range(1,10):
and indefinite loops which don't have the number of iterations known before it is executed. E.g. this while loop:
while answer <> "Yes": answer = input("are you an idiot?")
I'm checking some teaching materials that have an example of a while loop that looks definite to me as by looking at the code you know exactly when it is going to end:
number = 1 while number <= 10: print(number) number = number +1
Is this example a definite loop even though we have to do a little work to work out the for loop equivalent?