input: Write a function to evaluate a postfix expression and return the evaluated value as an integer. If the expression is empty, return 0.
  def evaluate(expression): 
    
      # If the expression is empty, return 0
      if not expression:
          return 0
    
      # split expression into list  
      expression = expression.split() 
    
      # stack to store integer values. 
      stack = []  
    
      # do for every element of expression. 
      for element in expression: 
    
          # If element is an operand push 
          # into stack it's a number only 
          if element.isdigit(): 
              stack.append(int(element)) 
    
          # if element is an operator, 
          # pop two elements from stack 
          # perform respective operations 
          else:  
              val1 = stack.pop() 
              val2 = stack.pop() 
              if element == '+':
                  stack.append(val2 + val1)
              elif element == '-':
                  stack.append(val2 - val1)
              elif element == '*':
                  stack.append(val2 * val1)
              elif element == '/':
                  stack.append(val2 / val1)
    
      # return the value  
      return stack[0]
  
  assert evaluate("2 3 + 4 5 * *") == 46
  assert evaluate("3 4 +") == 7
  assert evaluate("5 3 - 2 *") == 4
  assert evaluate("10 2 /") == 5
  assert evaluate("") == 0
output: def evaluate(expression): 
    
      # If the expression is empty, return 0
      if not expression:
          return 0
    
      # split expression into list  
      expression = expression.split() 
    
      # stack to store integer values. 
      stack = []  
    
      # do for every element of expression. 
      for element in expression: 
    
          # If element is an operand push 
          # into stack it's a number only 
          if element.isdigit(): 
              stack.append(int(element)) 
    
          # if element is an operator, 
          # pop two elements from stack 
          # perform respective operations 
          else:  
              val1 = stack.pop() 
              val2 = stack.pop() 
              if element == '+':
                  stack.append(val2 + val1)
              elif element == '-':
                  stack.append(val2 - val1)
              elif element == '*':
                  stack.append(val2 * val1)
              elif element == '/':
                  stack.append(val2 / val1)
    
      # return the value  
      return stack[0]