Integer division

jm.suresh@no.spam.gmail.com jm.suresh at gmail.com
Thu Jun 7 11:06:56 CEST 2007


Hello all,
 I have two integers and I want to divide one by another, and want to
get an integer result which is the higher side whenever the result is
a fraction.
 3/2 => 1 # Usual behavior
 some_func(3, 2) => 2 # Wanted

Any easier solution other than int(math.ceil(float(3)/2))

-
Suresh




More information about the Python-list mailing list