Write a function in Python POP(Arr), where Arr is a stack implemented by a list of numbers. The function returns the value deleted from the stack.
Answer:
def POP(Arr):
top=len(Arr)-1
if len(Arr)!=0:
deleted_val=Arr[top]
Arr.pop()
else:
print("Stack is Empty")
return deleted_val