How to add two fractions in Python

1 Answer

0 votes
from fractions import Fraction 
  
print(Fraction(1, 2) + Fraction(2, 3) )


'''
run:

7/6

'''

 



answered Apr 11, 2019 by avibootz

Related questions

1 answer 154 views
1 answer 152 views
152 views asked Apr 11, 2019 by avibootz
1 answer 149 views
149 views asked Apr 11, 2019 by avibootz
1 answer 175 views
1 answer 178 views
1 answer 153 views
1 answer 140 views
...