title: looking for different ways to implement it via python
body: <ul>
  <li>Write a simple interpreter which understands "+", "-", and "*" operations. </li>
  <li>Apply the operations in order using command/arg pairs starting with the initial value of <code>value</code>. </li>
  <li>If you encounter an unknown command, return -1. </li>
  </ul>
  
  <p>Examples : </p>
  
  <ul>
  <li><code>interpret(1, ["+"], [1])</code> → 2 </li>
  <li><code>interpret(4, ["-"], [2])</code> → 2 </li>
  <li><code>interpret(1, ["+", "*"], [1, 3])</code> → 6</li>
  </ul>
  
  
  
  <pre><code>def len_n(val, command, args):
  
    if command == '+' :
      return val + args
    elif command == '-':
      return val - args
    elif command == '*':
      return val * args
    else:
      return -1
  
  def interpret(val, command, args):
  
    count = len(command)
  
    for i in range(count) :
      val = len_n(val,command[i],args[i])
  
    return val
  *****************
  
  ************************
    final = len_n(val,command[0],args[0])
    del command[0]
    del args[0]
    if command[0:]:
      final = interpret(final, command, args)
  
    return final
  ****************
  </code></pre>
  
  <p>I tried by above 2 methods both worked as well! what are other methods this can be implemented? Thanks,</p>