Python Forum
fraction module: can you stop the reducing?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
fraction module: can you stop the reducing?
#1
when you import the fraction module, you can instantiate a Fraction instance:

from fractions import Fraction as frac
a = frac(1,3)
b = frac(1,6)
c = a+b
print('sum is {0}'.format©)

1/2

But I would like have the reducible form of 3/6

Is there a switch I'm missing in rationals, fractions, etc? that would cause the fraction to NOT be put in irreducible form?

Tnx
Reply


Messages In This Thread
fraction module: can you stop the reducing? - by qmfoam - Oct-10-2020, 05:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  method to remove zero digits from fraction in decimal Skaperen 17 2,773 Oct-23-2022, 04:02 AM
Last Post: Skaperen
  Reducing runtime memory usage in Cpython interpreter david_the_graower 2 2,227 Oct-18-2021, 09:56 PM
Last Post: david_the_graower
  Reducing JSON character count in Python for a Twitter Bot johnmitchell85 2 53,936 Apr-28-2021, 06:08 PM
Last Post: johnmitchell85
  Fraction Calculation with Limitations TINMAN01 13 5,431 Dec-22-2020, 04:45 AM
Last Post: bowlofred
  Need help reducing some code around a subprocess anistorian 4 2,962 Jun-12-2019, 03:32 PM
Last Post: snippsat
  output list reducing each time through loop 3Pinter 6 3,533 Mar-19-2019, 01:31 PM
Last Post: perfringo
  whole number and fraction Skaperen 11 5,593 Mar-17-2019, 11:33 PM
Last Post: Skaperen
  Stop execution of a module catosp 4 3,512 Sep-11-2018, 06:55 PM
Last Post: catosp
  Reducing code length xavier992 4 4,425 Jul-22-2017, 12:45 AM
Last Post: xavier992

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020