Open In App

sympy.frac() method in Python

Improve
Improve
Like Article
Like
Save
Share
Report

The sympy.frac(x) function represents the fractional part of x. For real numbers, it is defined as, x – [x] 
 

Syntax : sympy.frac() 

Return : Return the simplified mathematical expression. 

Example #1 : 

Python3




# import sympy 
from sympy import *
    
# Use sympy.frac() method 
gfg = frac(5.36)
      
print(gfg)


Output : 

0.36

Example #2 :

Python3




# import sympy 
from sympy import *
    
# Use sympy.frac() method 
gfg = frac(Rational(7, 5))
      
print(gfg)


Output : 

2 / 5

Last Updated : 29 Jul, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads