Python‎ > ‎math‎ > ‎

math.ceil()

http://www.adilwaseem.com/

Introduction
The method will return the values which is equal or greater to the functional integer value.

Syntax
math.ceil(x)

Parameters
Number

Examples 
The method return with the math.ceil() value.
 >>> import math
>>> math.ceil(3.4)
4
>>> math.ceil(44.5)
45
>>> math.ceil(322.333)
323

operator.itruediv
The operator.itruediv get the value of:
 >>> import operator
>>> import math
>>> operator.itruediv(math.ceil(1), math.sin(1))
1.1883951057781212


for statement
Method run the loop for sets.
import math
set1={math.trunc(1.1),math.sqrt(49),math.pow(4,2),math.e,math.exp(44)}
set2={math.floor(3.12),math.fmod(3,2),math.fabs(22), math.ceil(1)}
for i in map(lambda a,b: a+b, set1, set2):
print(i)

>>> 
17.0
4
24.718281828459045
>>>



if statement sum(map(lamda))__lt__(value()
If statement returns that the sum of the x/y is not less than 2.
 import math
x={math.factorial(81),math.sqrt(49),math.pow(4,2),math.e,math.exp(44)}
y={math.floor(3.12),math.fmod(3,2),math.fabs(22), math.ceil(1)}
if sum(map(lambda a,b: a/b, x,y)).__lt__(2):
                                                        print("The sum of x and y is less than 2")
else:
       print("The sum of x and y is greater than 2.")
>>> 
The sum is greater than 2.
>>>


Comments