- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstack.py
More file actions
Latest commit
22 lines (16 loc) · 397 Bytes
/
Copy pathstack.py
File metadata and controls
22 lines (16 loc) · 397 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""
Stack implementation with list
"""
classStack:
def__init__(self):
self.items= []
defisEmpty(self):
returnself.items== []
defpush(self, item):
self.items.append(item)
defpop(self):
returnself.items.pop()
defpeek(self):
returnself.items[len(self.items)-1]
defsize(self):
returnlen(self.items)