isfinite() in python by R4R Team

-isfinite() is a python function which is predefined in math library. and use for check that the number is finite or not.
-If number is finite then it will return True
-If number is not finite or NaN then it will return the false.

program-

import math
print("Enter any number")
a=int(input())
print(math.isfinite(a))
print(math.isfinite(-532))
print(math.isfinite(-2/5))
print(math.isfinite(0.00000))


output -

Enter any number
7
True
True
True
True


-In this program, firstly we import the 'math' library by using import math then we take input of number then check it is finite or not, and print True or False as per the value.

Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!