forked from Khanyi-Codes/Python-Simple-Test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalculator.py
More file actions
94 lines (83 loc) · 2.15 KB
/
Copy pathcalculator.py
File metadata and controls
94 lines (83 loc) · 2.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
def addition(a, b):
"""
Returns the sum of a and b.
Args:
a (int or float): First number.
b (int or float): Second number.
Returns:
int or float: The sum of a and b.
"""
return ""
def subtraction(a, b):
"""
Returns the difference of a and b.
Args:
a (int or float): First number.
b (int or float): Second number.
Returns:
int or float: The result of a - b.
"""
return ""
def multiplication(a, b):
"""
Returns the product of a and b.
Args:
a (int or float): First number.
b (int or float): Second number.
Returns:
int or float: The product of a and b.
"""
return ""
def division(a, b):
"""
Returns the quotient of a divided by b.
Args:
a (int or float): Numerator.
b (int or float): Denominator.
Returns:
float: The result of a / b.
"""
return ""
def modulus(a, b):
"""
Returns the remainder of a divided by b.
Args:
a (int or float): Numerator.
b (int or float): Denominator.
Returns:
int or float: The remainder after division.
"""
return ""
def exponentiation(a, b):
"""
Returns a raised to the power of b.
Args:
a (int or float): Base number.
b (int or float): Exponent.
Returns:
int or float: The result of a ** b.
"""
return ""
def floor_division(a, b):
"""
Returns the floor division of a by b.
Args:
a (int or float): Numerator.
b (int or float): Denominator.
Returns:
int: The result of a // b.
"""
return ""
def calculator(num1, operation, num2):
"""
Performs a calculation based on the given operation and numbers.
Args:
num1 (int or float): The first number.
operation (str): The operation to perform. Supported values: '+', '-', '*', '/', '%', '**', '//'.
num2 (int or float): The second number.
Returns:
int or float: The result of the calculation, or an error message if the operation is invalid.
Example:
result = calculator(5, '+', 3) # Returns 8
"""
return ""