-
Notifications
You must be signed in to change notification settings - Fork 0
/
02_03b.py
29 lines (27 loc) · 714 Bytes
/
02_03b.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
from collections import deque
class task(object):
def __init__(self, taskDesc, hasPriority = False):
self.taskDesc = taskDesc
self.hasPriority = hasPriority
def __str__(self):
return "Task {0}, Priority {1}".format(self.taskDesc, self.hasPriority)
taskQ = deque()
def addTask(task):
if task.hasPriority:
taskQ.appendleft(task)
else:
taskQ.append(task)
def DoTask():
return taskQ.popleft()
def printTask():
for i in taskQ:
print(i.taskDesc)
def main():
addTask(task("Make list"))
addTask(task("Make breakfast"))
addTask(task("Pay bills", True))
printTask()
print(DoTask())
return
if __name__ == "__main__":
main()