- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstack.py
More file actions
Latest commit
26 lines (19 loc) · 490 Bytes
/
Copy pathstack.py
File metadata and controls
26 lines (19 loc) · 490 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
classStack:
def__init__(self):
self.stack= []
defpush(self, element):
self.stack.append(element)
defpop(self):
delself.stack[self.size()-1]
defprintAll(self):
print(self.stack)
defsize(self):
returnlen(self.stack)
defempty(self):
returnself.size() ==0
stack_instance=Stack()
stack_instance.push('a')
stack_instance.push('b')
stack_instance.push('c')
stack_instance.pop()
stack_instance.printAll()