Professional Documents
Culture Documents
Built
Built
#The min() and max() functions can be used to find the lowest or highest value in an iterable:
# round(): This function returns a floating point number that is rounded version of the specified number.
#abs() :The abs() function returns the absolute (positive) value of the specified number:
#pow():The pow(x, y) function returns the value of x to the power of y (xy).This function requires two
parameter first is base and second is power.
#Eg
print(x)
print(y)
print(round(10.2345))
print(round(5.76543))
print(abs(-5))
print(abs(5))
output:
25
10
2 raised to 5: 32
7 raised to 0: 1
Python has also a built-in module called math, which extends the list of mathematical functions.
import math
#ceil(): The math.ceil() method rounds a number upwards to its nearest integer,
#floor(): method rounds a number downwards to its nearest integer, and returns the result:
import math
x = math.ceil(1.4)
y = math.floor(1.4)
print(x) # returns 2
print(y) # returns 1
#The math.sqrt() method for example, returns the square root of a number:
import math
a = math.sqrt(64)
x = math.pi
y = math.cos(3)
print(y) # returns-0.9899924966004454
z = math.sin(6)
a=10
b=True
c=16.55
d=[1,2,3]
print("Type of a is :",type(a))
print("Type of b is :",type(b))
print("Type of c is :",type(c))
print("Type of d is :",type(d))
list1=[10,20,30]
list2=[40,50,60]
tuple=(70,80,90)
ID of tuple is : 1873523446272
a=10
list=[10,20,30]
Bin() :This Functions returns the binary conversion of specified integer parameter.
Float(): This function converts and return provided parameter value into ‘float’.
Int():This Function converts and returns provided parameter value into ‘int’.
Tuple(): This Function converts specified data –structure inot tuple and returns.
List():This Function converts specified data structure into list and returns.
tuple=(10,20,30)
a=list(tuple)
tuple=(1,2,3,4)
b=set(tuple)
Output:
Integer equivalent of 15 is : 15
Tuple conversion of List is [10, 20, 30] and its type is <class 'list'>