By Hemanta Sundaray on 2021-09-09
Returns the absolute value of number x. (converts negative numbers to positive).
print(abs(3.14))
# 3.14
print(abs(-3.14))
# 3.14
Converts the number x to a float data type.
print(float(3))
# 3.0
print(float(-3))
# -3.0
Converts the number x to the integer data type by truncating (not rounding) the decimal point and any digits after it.
print(int(3.1426))
# 3
Takes any number of numeric arguments and returns whichever one is the largest.
print(max(3.1426, 12, 20, -9.876))
# 20
Takes any number of numeric arguments and returns whichever one is the smallest.
print(min(3.1426, 12, 20, -9.876))
# -9.876
Rounds the number x to y number of decimal places.
print(round(3.9, 2))
# 3.9
Converts number x to the string data type.
string_type = str(3.9)
print(type(string_type))
# <class 'str'>
Returns a string indicating the data type of x.
print(type(26))
# <class 'int'>