How to reverse order the list containing strings where def view(self), because with reversed() I get an error that it can't be done with strings. Any help?
class Stack():
def __init__(self):
self.stack = []
def view(self):
for x in reversed(self.stack):
print(self.stack[x])
def push(self):
item = input("Please enter the item you wish to add to the stack: ")
self.stack.append(item)
def pop(self):
item = self.stack.pop(-1)
print("You just removed item: {0}".format(item))
stack = Stack()