1. add (a, b) : — This function returns the addition of the given arguments.
Operation — a + b.
2. sub (a, b) : — This function returns the difference of the given arguments.
Operation — a — b.
3. mul (a, b) : — This function returns the product of the given arguments.
Operation — a * b.
|
Output:
The addition of numbers is: 7 The difference of numbers is: 1 The product of numbers is: 12
4. truediv (a, b) : — This function returns the separation of the given arguments.
Operation — a / b.
5. floordiv (a, b) : — This function also returns the division of the given arguments. But the value is an intermediate value, that is, returns the largest small integer .
Operation — a // b.
6. pow (a, b) : — This function returns raising to the power of the given arguments.
Operation — a ** b.
7. mod (a, b) : — this function returns the module of the given arguments.
Operation — % b.
|
Output:
The true division of numbers is: 2.5 The floor division of numbers is: 2 The exponentiation of numbers is: 25 The modulus of numbers is: 1
8. lt (a, b) : — This function is used to check if a is less than b or not . Returns true if a is less than b, otherwise returns false.
Operation — a "b .
9. le (a, b) : — This function is used to check if ab is less than or equal to . Returns true if a is less than or equal to b, otherwise returns false.
Operation — a "= b .
10. eq (a, b) : — This function is used to check if ab is equal to or not . Returns true if a is equal to b, otherwise returns false.
Operation — a == b .
|
Output:
3 is not less than 3 3 is less than or equal to 3 3 is equal to 3
11. gt (a, b) : — This function is used to check if a is greater than b or not . Returns true if a is greater than b, otherwise returns false.
Operation — a" b .
12. ge (a, b) : — This function is used to check whether a is greater than or equal to a or less than b . Returns true if a is greater than or equal to b, otherwise returns false.
Operation — a" = b .
13. ne (a, b) : — This function is used to check if a is not equal to b or . Returns true if a is not equal to b, otherwise returns false.
Operation — huh! = B.
|
Output:
4 is greater than 3 4 is greater than or equal to 3 4 is not equal to 3
This article is courtesy of Manjeet Singh . If you are as Python.Engineering and would like to contribute, you can also write an article using contribute.python.engineering or by posting an article contribute @ python.engineering. See my article appearing on the Python.Engineering homepage and help other geeks.
Please post comments if you find anything wrong or if you would like to share more information on the topic discussed above.