abs() function in python by R4R Team

abs() is a build-in function in python which return the absolute value of given number.

Example-
number is -23
absolute value is 23

Program-

print("Enter any number")
n=int(input())
print("Absolute value is ",abs(n))
print(type(n))
print(type(abs(n)))


output -

Enter any number
-23
Absolute value is 23


-In this program, we take a number as a input and we print the absolute value of the number with the help of the abs() function.

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!