Menu
×
×
Correct!
Exercise:What is missing?
class Stack:
def __init__(self):
self.stack = []
def push(self, element):
self.stack.append(element)
def pop(self):
if self.@(9):
return "Stack is empty"
return self.stack.pop()
def peek(self):
if self.@(9):
return "Stack is empty"
return self.stack[-1]
def isEmpty(self):
return len(self.stack) == 0
def size(self):
return len(self.stack)
class Stack:
def __init__(self):
self.stack = []
def push(self, element):
self.stack.append(element)
def pop(self):
if self.isEmpty():
return "Stack is empty"
return self.stack.pop()
def peek(self):
if self.isEmpty():
return "Stack is empty"
return self.stack[-1]
def isEmpty(self):
return len(self.stack) == 0
def size(self):
return len(self.stack)
Not CorrectClick here to try again. Correct!Next ❯ |
This will reset the score of ALL 43 exercises.
Are you sure you want to continue?