How are you trying to debug the code? Add some print statements that print out the values of the variables as the code executes. The printed values will show you what the program is doing and help...