-
Notifications
You must be signed in to change notification settings - Fork 48
/
operator_examples.py
39 lines (30 loc) · 1.02 KB
/
operator_examples.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
Example Operators
"""
def add_numbers(num1, num2):
"""Returns the addition of two integers."""
return num1 + num2
def subtract_numbers(num1, num2):
"""Returns the subtraction of two integers."""
return num1 - num2
def multiply_numbers(num1, num2):
"""Returns the multiplication of two integers."""
return num1 * num2
def divide_with_slash(num1, num2):
"""Returns the division of two integers."""
return num1 / num2
def modulo_division(num1, num2):
"""Returns the remainder after division of two integers."""
return num1 % num2
def is_a_greater_than_b(num1, num2):
"""Predicate function evaluating whether num1 is greater than num2."""
return num1 > num2
def is_a_equal_to_b(num1, num2):
"""Predicate function evaluating whether num1 is equal to num2."""
return num1 == num2
def as_a_float(num1):
"""Returns the float value of a number passed in."""
return float(num1)
def as_an_int(num1):
"""Returns the integer value of a number passed in."""
return int(num1)