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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy