forked from ga-wdi-boston/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoperator_examples.py
More file actions
43 lines (33 loc) · 1.15 KB
/
operator_examples.py
File metadata and controls
43 lines (33 loc) · 1.15 KB
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
40
41
42
43
"""
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)
def exponentiation(num1,num2):
"""Returns the value obtained by raising num1 to the power of num2."""
return (num1**num2)