elif'+'insubexpror'-'insubexpr:# Addition and subtraction have the same precedence
index_plus,index_minus=float('inf'),float('inf')# Set both values to infinity
if'+'insubexpr:
index_plus=subexpr.index('+')
if'-'insubexpr:
index_minus=subexpr.index('-')
index=index_plusifindex_plus<index_minuselseindex_minus# Set the index to the index of the operator that occurs first
subexpr[index]=float(subexpr[index-1])+float(subexpr[index+1])ifindex_plus<index_minuselsefloat(subexpr[index-1])-float(subexpr[index+1])# If addition occured first, add the previous and next tokens. If subtraction occured first, subtract them.