classStack():'''stack'''def__init__(self):
self.__list = []
defpush(self, item):'''add a new element to the top of the stack'''
self.__list.append(item)
defpop(self):'''popup stack top elements'''return self.__list.pop()
defpeek(self):'''returns the top elements of the stack'''if self.__list:
return self.__list[-1]
else:
returnNonedefis_empty(self):'''determines whether the stack is empty'''return self.__list == []
defsize(self):'''Returns the number of elements in the stack'''return len(self.__list)
defmain():
s1 = Stack()
s1.push(1)
s1.push(2)
s1.push(3)
s1.push(2)
print(s1.pop())
print(s1.pop())
print(s1.pop())
print(s1.pop())
if __name__ == '__main__':
main()
---------------results of enforcement----------
2321
-----------------------------------------------
Stackclass Stack(): '''stack''' def __init__(self): self.__list = [] def push(self, item): '''add a new element to the top of the stack''' self.__list.append(i...