-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDISPATCH METHOD.py
35 lines (34 loc) · 1.17 KB
/
DISPATCH METHOD.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
from multipledispatch import dispatch
class players:
@dispatch(str, int)
def goals(self, a,b):
print(a, 'scored at ', b, 'minutes')
@dispatch(str, str, int)
def goals(self, a,b,c):
print(a, 'charged for foul and received ', b, ' at ',c, ' minutes.')
@dispatch(str, int, str)
def goals(self, a, b, c):
print(a, ' got substituted at ', b, ' minutes ', ' by ', c)
#===========================================
inp = input("Announcement: ")
if inp == 'goal':
goal_scorer = input("Goal Scorer: ")
minute = int(input("minute: "))
score = players()
score.goals(goal_scorer, minute)
elif inp == 'card':
card_holder = input("Card holder : ")
minute = int(input('Minute: '))
card = input("Card name: ")
score = players()
score.goals(card_holder, card, minute)
elif inp == 'sub':
subbed = input("Subbed player: ")
minute = int(input('Minute: '))
on_field = input("Player on field: ")
score = players()
score.goals(subbed, minute, on_field)
# score = players()
# score.goals(goal_scorer, minute)
# score.goals(card_holder, card, minute)
# score.goals(subbed, minute , on_field)