[Tutor] Simple variable type question

ALAN GAULD alan.gauld at btinternet.com
Fri Feb 5 21:39:09 CET 2010


>>>>Or just 
>>>>     return float(y2-y1/x2-x1)
>Alan why are you suggesting this, surely this will cause the decimal values to be truncated?  Or does this somehow work differently in Python 3? 

It would work different in v3 because / is no longer interger division.
However, I just misplaced the ) It should have been after y1.

return float(x1-y1)/(x2-y2)

Sorry about that.

Alan G.

More information about the Tutor mailing list