| 1 | initial version |
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:
| 2 | No.2 Revision |
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.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.