forked from AJmight/pythonrecess
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwk2eve.py
More file actions
23 lines (19 loc) · 743 Bytes
/
wk2eve.py
File metadata and controls
23 lines (19 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# def sum(x,y):
# result=x+y
# print(f"The sum of {x} and {y} is: {result}")
# def sum(x,y,z):
# result=x+y+z
# print(f"The sum of {x}, {y}, and {z} is: {result}")
# sum(5, 10) # This will call the first sum function
# sum(5, 10, 15) # This will call the second sum function with three parameters
from multipledispatch import dispatch
@dispatch(int, int)
def sum(x, y):
result = x + y
print(f"The sum of {x} and {y} is: {result}")
@dispatch(int, int, int)
def sum(x, y, z):
result = x + y + z
print(f"The sum of {x}, {y}, and {z} is: {result}")
sum(5, 10) # This will call the first sum function
sum(5, 10, 15) # This will call the second sum function with three parameters