-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctions.py
More file actions
32 lines (22 loc) · 751 Bytes
/
Functions.py
File metadata and controls
32 lines (22 loc) · 751 Bytes
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
import sys
def do_calc(operation, num1, num2):
match operation:
case "a" | "add":
return num1 + num2
case "s" | "subtract":
return num1 - num2
case "m" | "multiply":
return num1 * num2
case "d" | "divide":
return num1 / num2
def print_answer(answer):
print("The answer to your calculation is " + str(answer))
sys.exit()
def square_or_cube(operation, num1):
match operation:
case "square":
return num1 * num1
case "cube":
return num1 * num1 * num1
def wrong_operation(operation):
print("Sorry, " + operation + " is not a valid operation.")