Ask Your Question

Revision history [back]

In your while d2>1*1: loop, d2 is a global variable, so after the first round, d2 becomes less than 1. Then this loop is never run again since the condition d2>1*1 is always False. This explains why (x2, y2) is always the same.

What you should do it to reset d2 at each loop:

d2 = 2
while d2>1*1:

In your while d2>1*1: loop, d2 is a global variable, so after the first round, d2 becomes less than 1. Then this loop is never run again since the condition d2>1*1 is always False. This explains why (x2, y2) is always the same.

What you should do it to reset d2 at each pass of the for loop:

d2 = 2
while d2>1*1:

By the way, replacing 1*1 by 1 won't change anything and will lead to a cleaner code.