"Antonio de la Fuente" <t...@muybien.org> wrote
the doctest for the slope function failed, because is expecting a
floating point value and not an integer:
So convert it to a float.
def slope(x1, y1, x2, y2):
result_slope = ((y2 - y1) / (x2 - x1)) * 1.0
return result_slope
return float(result_slope)
Or just
return float(y2-y1/x2-x1)
You might want to use a try/except to catch a zero division error too?
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor