- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack.py
More file actions
Latest commit
24 lines (19 loc) · 446 Bytes
/
Copy pathstack.py
File metadata and controls
24 lines (19 loc) · 446 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
classStack():
def__init__(self):
self.items= []
defis_empty(self):
returnself.items== []
defpush(self, item):
self.items.append(item)
defpop(self):
returnself.items.pop()
defget_stack(self):
returnself.items
s=Stack()
print(s.is_empty())
s.push("A")
s.push("B")
print(s.get_stack())
s.pop()
print(s.get_stack())
print(s.is_empty())