-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path08-call_center.py
More file actions
executable file
·47 lines (41 loc) · 1.35 KB
/
08-call_center.py
File metadata and controls
executable file
·47 lines (41 loc) · 1.35 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
calls = []
class Call(object):
def __init__(self,name,phone,time,reason):
self.uid = len(calls)
self.name = name
self.phone = phone
self.time = time
self.reason = reason
calls.append(self)
def display(self):
for i in vars(self).items():
print i[0]+":",i[1]
call = Call("Will","123-123-1231","3:30PM","Prank Call")
call2 = Call("Dan","987-654-3210","5:30PM","Question about purchase")
call3 = Call("Minh","456-789-1230","1:30PM","Account assistance")
class CallCenter(object):
def __init__(self):
self.calls = []
self.queue = len(self.calls)
def add(self,call):
if type(call) != Call:return
self.calls.append(call)
self.queue = len(self.calls)
def remove(self,phone):
call = 0
for ind in range(0,len(self.calls)-1):
call = self.calls[ind]
if call.phone == phone:
print "Removed call from: {}\n".format(call.name)
self.calls.pop(ind)
self.queue = len(self.calls)
def info(self):
for call in self.calls:
print call.display(),"queue:{}".format(self.queue),"\n"
callCenter = CallCenter()
callCenter.add(call)
callCenter.add(call2)
callCenter.add(call3)
callCenter.info()
callCenter.remove("987-654-3210")
callCenter.info()