in reply to Re^5: solve cubic equations (Python)
in thread solve cubic equations
I guess most people do, but I don't care for it. If I have an integer, I need to use // to divide, or it gets converted to a float. If I have a Fraction, I need to use /, or it gets converted to an integer. You say, "but // always produces an integer, that's so much easier." But I don't see why there has to be a special operator devoted to integers.
>>> from fractions import Fraction >>> x = Fraction(22,7) >>> y = 3 >>> print(x,x/2,x//2) 22/7 11/7 1 >>> print(y,y/2,y//2) 3 1.5 1
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: solve cubic equations (Python)
by LanX (Saint) on May 05, 2017 at 19:07 UTC | |
by no_slogan (Deacon) on May 05, 2017 at 19:22 UTC | |
by LanX (Saint) on May 05, 2017 at 23:20 UTC | |
by no_slogan (Deacon) on May 05, 2017 at 23:26 UTC | |
by no_slogan (Deacon) on May 06, 2017 at 16:07 UTC | |
by LanX (Saint) on May 06, 2017 at 15:28 UTC | |
by Anonymous Monk on May 05, 2017 at 20:49 UTC |
In Section
Cool Uses for Perl