Go: package main

import (
	"bufio"
	"fmt"
	"go/token"
	"go/types"
	"os"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	n, _ := strconv.Atoi(stdin.Text())
	for i := 0; i < n; i++ {
		stdin.Scan()
		exp := strings.TrimRight(stdin.Text(), "=")
		res, _ := types.Eval(token.NewFileSet(), nil, token.NoPos, exp)
		fmt.Println(res.Value)
	}
}

Python: from collections import deque

def eva(l, r, op):
    if op == "+":
        return l + r
    elif op == "-":
        return l - r
    elif op == "*":
        return l * r
    elif op == "/":
        return l // r


def calc(exp):
    i = 0
    num = deque()
    ops = deque()
    ope = ""
    while i < len(exp):
        if exp[i] == '(':
            end = 1
            s = 1
            while True:
                if exp[i+end] == "(":
                    s += 1
                elif exp[i+end] == ")":
                    s -= 1
                if s == 0:
                    break
                end += 1
            num.append(calc(exp[i+1:i+end]))
            i += end
            if ope:
                l = num.pop()
                r = num.pop()
                num.append(eva(l, r, ope))
                ope = ""
        if exp[i] in ["*", "/"]:
            ope = exp[i]
        elif exp[i] in ["+", "-"]:
            ops.append(exp[i])
        elif exp[i] == "=":
            pass
        else:
            temp = ""
            j = 0
            while i + j < len(exp) and exp[i+j].isnumeric():
                temp += exp[i+j]
                j += 1
            num.append(int(temp))
            i += j - 1
            if ope:
                num.append(eva(num.pop(), num.pop(), ope))
                ope = ""
        i += 1
    while len(ops) != 0:
        l = num.popleft()
        r = num.popleft()
        num.appendleft(eva(l,r,ops.popleft()))
    
    return num[0]


n = int(input())
for i in range(n):
    exp = input()
    print(calc(exp))

# N = int(input())
# for i in range(N):
#     print(int(eval(input().replace("/", "//").strip("="))))

Python: from collections import deque
def eva(l, r, op):
    if op == "+":
        return l + r
    elif op == "-":
        return l - r
    elif op == "*":
        return l * r
    elif op == "/":
        return l // r


def calc(exp):
    print("calculate",exp)
    i = 0
    num = deque()
    ops = deque()
    ope = ""
    while i < len(exp):
        print(num, ope, exp[i])
        if exp[i] == '(':
            end = exp[i + 1:].index(")")
            num.append(calc(exp[i + 1:i + 1 + end]))
            i += end
            if ope:
                num.append(eva(num.pop(), num.pop(), ope))
                ope = ""
        if exp[i].isnumeric():
            num.append(int(exp[i]))
            if ope:
                num.append(eva(num.pop(), num.pop(), ope))
                ope = ""
        elif exp[i] in ["*", "/"]:
            ope = exp[i]
        elif exp[i] in ["+", "-"]:
            ops.append(exp[i])
        elif exp[i] == "=":
            break
        i += 1
    while len(ops) != 0:
        l = num.popleft()
        r = num.popleft()
        num.appendleft(eva(l,r,ops.popleft()))
    print(f'function end, return {num[0]}')
    return num[0]


n = int(input())
for i in range(n):
    exp = input()
    print(calc(exp))

# N = int(input())
# for i in range(N):
#     print(int(eval(input().replace("/", "//").strip("="))))

Python: n=int(input())
for i in range(n):
	a=input()
	b=""
	for i in a:
		b+=i
		if i=='/':b+='/'
	print(eval(b[:len(b)-1]))

Python: n=int(input())

for t in range(n):
    s=input()
    s=s[:-1]
    print(eval(s))

Python: import sys

input()
for i in sys.stdin.readlines():
        print(int(eval(i[:-2])))

Python: def ReversePolishNotation(string):

    priority = {"Sentinel": 0, "(": 0, "+": 1, "-": 1, "*": 2, "/": 2}

    stack = []
    signStack = ["Sentinel"]

    for item in string[:-1]:
        if item == "(":
            signStack.append(item)
        elif item == ")":
            while signStack[-1] != "(":
                stack.append(signStack.pop())
            signStack.pop()
        else:
            if item in priority.keys():
                if priority[signStack[-1]] < priority[item]:
                    signStack.append(item)
                else:
                    top = signStack.pop()
                    stack.append(top)
                    signStack.append(item)
            else:
                stack.append(item)

    while signStack[-1] != "Sentinel":
        stack.append(signStack.pop())

    return stack


def Calculate(formulaList):

    signs = ["+", "-", "*", "/"]

    stack = []

    for item in formulaList:

        if item not in signs:
            stack.append(item)
        else:
            num1 = int(stack.pop())
            num2 = int(stack.pop())

            result = 0
            #
            if item == "+":
                result = num2 + num1
            elif item == "-":
                result = num2 - num1
            elif item == "*":
                result = num2 * num1
            else:
                #result = num2 / num1
                pass

            stack.append(int(result))

    return int(stack[0])


inputCount = int(input())

for lp in range(inputCount):
    formula = input()

    rpn = ReversePolishNotation(formula)
    answer = Calculate(rpn)

    print(str(answer))

Python: n = int(input())
[print(eval(input()[:-1])) for i in range(n)]

Python: #!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit
from operator import add, sub, mul, truediv


def div(a, b):
    return int(truediv(a, b))


class Parser(list):
    """
    <statement> ::= <expression> "="
    <expression> ::= <term> [ ("+"|"-") <term> ]
    <term> ::= <factor> [ ("*"|"/") <factor> ]
    <factor> ::= <number> | "(" <expression> ")"
    """

    def __init__(self, tokens):
        self._iter_tokens = iter(tokens)

        self._next_symbol()
        while self.symbol != '=':
            self._expression()

    def _expression(self, fn_table={'+': add, '-': sub}):
        if self.symbol in fn_table:
            op_sign = self.symbol
            self._next_symbol()
            self._term()
            self.append(fn_table[op_sign])
        else:
            self._term()

        while self.symbol in fn_table:
            op_sign = self.symbol
            self._next_symbol()
            self._term()
            self.append(fn_table[op_sign])

    def _term(self, fn_table={'*': mul, '/': div}):
        self._factor()
        while self.symbol in fn_table:
            op_sign = self.symbol
            self._next_symbol()
            self._factor()
            self.append(fn_table[op_sign])

    def _factor(self):
        if self.symbol.isdigit():
            self.append(int(self.symbol))
            self._next_symbol()
        elif self.symbol == '(':
            self._next_symbol()
            self._expression()
            if self.symbol != ')':
                raise SyntaxError(self.symbol)
            self._next_symbol()
        else:
            raise SyntaxError(self.symbol)

    def _next_symbol(self):
        self.symbol = next(self._iter_tokens)


def tokenize(line):
    buf = []
    tokens = []

    for c in line:
        if c.isdigit():
            buf.append(c)
        else:
            if buf:
                tokens.append(''.join(buf))
                del buf[:]
            tokens.append(c)
            if c == '=':
                return tokens


def run(commands):
    stack = []

    for cmd in commands:
        if isinstance(cmd, int):
            stack.append(cmd)
        else:
            buf = stack.pop()
            stack[-1] = cmd(stack[-1], buf)
    return stack[-1]


def main(readline=stdin.readline):
    for _ in range(int(readline())):
        print(run(Parser(tokenize(readline()))))
    exit()


if __name__ == '__main__':
    main()

Python: n = int(input())
for _ in range(n):
    print(eval(input()[:-1]))