Skip to content

Commit ed2ca44

Browse files
committed
getStack and Reverse Stack
1 parent 0ce6ff3 commit ed2ca44

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lab-11/stack.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Stack(list):
2+
def __init__(self):
3+
super().__init__()
4+
self.stack = []
5+
6+
7+
def getStack(self):
8+
for i in range(5):
9+
self.stack.append(input(f"Enter string {i + 1} out of 5: "))
10+
11+
def reverseStack(self):
12+
for i in range(1, 6):
13+
print(self.stack[-i])
14+
15+
x = Stack()
16+
x.getStack()
17+
x.reverseStack()

0 commit comments

Comments
 (0)