Why are my fish and bubbles slowly leaving the window?

I got my bobbing fish and bubbles, but they both work their way out of the window after a while, for some reason. The fish slowly go up, and the bubbles slowly go to the left, and after a couple minutes, the window is empty. I think it has something to do with how my count function works, but I'm not sure. The following is a section from my move function in my fish class. In the setupFish function I set: `count = random.randrange(0, 20)`

``````if self.count == 20:
self.count = 0

if 20 > self.count > 10:
dy = 1

elif self.count <= 10:
dy = -1
``````

With help from Dr. Stonedahl, I was able to work this out: because dy was -1 when count was 0 - 10 and 1 when count was 11 - 19, it was more likely to be 1 than -1, so I needed to make it so when count was 10, dy was 1, so that dy was equally likely to be 1 or -1.

As when 'count' reaches 20, it will be reset to 0. The second if statement is for when 'count' is somewhere between 10 to 19. Therefore, you can clearly let `dy = -1` outside of all the if/else statement because 'count' will always in between 0-9, if it does not meet the bool of the if statements.
Secondly, `x <= 10` means that the range contains 10 numbers, while `20 > x > 10` only contains 8 numbers. Because of that, the likelihood of `dy = -1` is more than `dy = 1`. That's why your fish and bubble slowly move outside of the window as dx and dy (respectively) have more chances of becoming negative over time.