Here's my code:
x = 20
for i in range(1,7):
    y = x/i
    print(i)    #  These lines are just to show what
    print(y)    #  the code is doing. I know it's not elegant.
    print(i*y)  #  And is not my final solution
    print('\n')
Here's my output:
1
20.0
20.0
2
10.0
20.0
3
6.666666666666667
20.0
4
5.0
20.0
5
4.0
20.0
6
3.3333333333333335
20.0
So why is every answer to the equation the same (20)? When i clearly changes? Say for the third iteration, when i=3, going to the interpreter and performing 3*(20/3) yields 18 correctly and not 20. So I'm not sure what's going on.
This is answered below. The difference between floats in python2.7 and python3
 
     
    