Questions tagged [python-fractions]

A Python module that provides support for rational number arithmetic.

21 questions
-1
votes
2 answers

How to determine the purchase price if the profit percentage is known

I want to do a story problem on the following math. A merchant sells an item at a price $210.00 and profit 5% of the price buy. Determine the purchase price the item. The answer is like the following . Then, I solved it with the code below. from…
Fahrizal
  • 47
  • 6
-1
votes
2 answers

How to transform a cube root of a fraction into an fraction without cube root in the denominator?

How do I write a python def function that can take the cube roots of fractions and return the answer as a fraction as a coefficient with a cube root in the numerator only? I am new to coding, so I apologize if my question sounds vague. I am trying…
Patman1O1
  • 5
  • 4
-1
votes
1 answer

Python prevent fractions.Fraction from reducing fractions

So I have a simple example: import fractions f = fractions.Fraction(6, 12) and I don't want f to become 1/2. I want it to remain 6/12. Is there a way to do this?
Oleksandr Novik
  • 489
  • 9
  • 24
-1
votes
1 answer

table time conversion nanoseconds to minute

the first table to be converted to minute: Time_sec >>> Time_Min) 362.7313 00:06:02,7 490.669 00:08:10,7 824.5673 00:13:44,6 951.829 00:15:51,8 13.0447 00:00:13,0 13.0678 00:00:13,1 122.5468 00:02:02,5 536.7552 …
e33
  • 15
  • 4
-2
votes
1 answer

sympy.Rational vs fractions.Fraction Comparison

Are there differences? if so, what are they? What are the advantages and disadvantages? If there are other implementations of rational numbers in python, feel free to include those in the comparison.
-3
votes
1 answer

how can I fix the number of digits after the decimal place in python?

For Example this is my list li = [4.0, 5.15445454, 1.1] and I want to this newli = [4.00000, 5.15445, 1.10000]
1
2