[Tutor] Division operation
Alan Gauld
alan.gauld at btinternet.com
Tue May 16 23:52:39 CEST 2006
> You can include the following in your program (I often do) if you
> want
> division to operate the way you expect:
>
>>>> from __future__ import division
>
Or you can do an explicit float conversion inside your function
if you don't want the import effect.
def f(x,y):
returm float(x)/y
This issue is discussed in the Simple Sequences topic
of my tutor.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list