OK! I got this code that does not work properly, Here is the code:
def abDucks (a,b):
while (a>1):
print(a, "Little Ducks swimming in the sea")
print("And if ",b," Little Ducks should accidentally drown")
print("There'll be ", (a-b), "Little Ducks swimming in the sea\n")
a=(a-b)
if (a<=1):
print(a, "Little Ducks swimming in the sea")
print("And if ",b," Little Ducks should accidentally drown")
print("There'll be no Little Ducks swimming in the sea\n")
The problem I have is that it counts to 0 and then it will print: And if no little ducks should accidentally drown There'll be no Little Ducks swimming in the sea
Please Help
I never did get an infinite loop lol :P This is what happens when I run this code using (8,2)
8 Little Ducks swimming in the sea And if 2 Little Ducks should accidentally drown There'll be 6 Little Ducks swimming in the sea 6 Little Ducks swimming in the sea And if 2 Little Ducks should accidentally drown There'll be 4 Little Ducks swimming in the sea 4 Little Ducks swimming in the sea And if 2 Little Ducks should accidentally drown There'll be 2 Little Ducks swimming in the sea 2 Little Ducks swimming in the sea And if 2 Little Ducks should accidentally drown There'll be 0 Little Ducks swimming in the sea 0 Little Ducks swimming in the sea And if 2 Little Ducks should accidentally drown There'll be no Little Ducks swimming in the sea