title: Python: Checking for a missing arithmetic operator between two values
body: <p>Somewhat new to programming and Python. I am writing a program to accept a string input from user, put the string into a list and the program will run through checks on the list to see if the expression is valid. If valid, the program will use eval the string and output the answer.</p>
  
  <p>The problem is that I am unable to figure out how code the check for the missing arithmetic operator between two values.</p>
  
  <p>I got an idea that in the function, I need a for loop to go through the list, compare the current value in the list against the next value in the list and if both don't match against a operator list which includes the operators, this means that I am missing an operator. </p>
  
  <p>So I think I have to write a if statement inside the for loop to do this. I also need the if statement to ignore the parentheses(if any) in the list. However, I am unable to figure how to code that if statement. </p>
  
  <p>Am I doing it the right way or is there an easier or better way to do this?</p>
  
  <p>I've included a simplified sample of my code below. Thanks. </p>
  
  <pre><code>def missingCheck(myList, operatorList):
  
    for currentToken in myList:
      if #not able to figure out this part
      count = myList.index(currentToken)
      strLeft = " ".join(myList[0:count])
      strRight = " ".join(myList[count:])
      print("Missing operator between {} and {}".format(strLeft, strRight))
    return
  
  def main():
    myList = []
    operatorList = ["+", "-", "/", "//", "*"]
  
    strInput = str("( 33 ) ( 1 )")  #hardcoded for checking, values differentiated with space
    myList = strInput.split(" ")
  
    missingCheck(myList, operatorList)
  
    #simplifed program for testing, there will be a eval(strInput) later to parse the string if the input is correct
    #Program would actually ask user for input.
    #strInput = str("3 4")      &lt;--- other sample input
    #strInput = str(1 2 + 3)    &lt;--- other sample input
  main()
  </code></pre>