File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ def __init__(self):
7
7
self .items = []
8
8
9
9
def stack_length (self ):
10
+ """
11
+ Finds length of the given stack
12
+ """
10
13
l = len (self .items )
11
14
if not self .items :
12
15
return "Empty Stack"
@@ -17,10 +20,16 @@ def stack_length(self):
17
20
pass
18
21
19
22
def push (self , value ):
23
+ """
24
+ Push value to the stack
25
+ """
20
26
self .items .append (value )
21
27
return self .items
22
28
23
29
def pop (self ):
30
+ """
31
+ Pops element from the stack
32
+ """
24
33
if not self .items :
25
34
return None
26
35
else :
@@ -35,6 +44,9 @@ def peek(self):
35
44
return self .items [- 1 ]
36
45
37
46
def min_element (self , stack_values ):
47
+ """
48
+ Returns the smallest element in the stack
49
+ """
38
50
self .items = stack_values
39
51
if not self .items :
40
52
print ("Empty Stack" )
You can’t perform that action at this time.
0 commit comments