Skip to content

Instantly share code, notes, and snippets.

View ArchieMeng's full-sized avatar

ArchieMeng ArchieMeng

View GitHub Profile
@ArchieMeng
ArchieMeng / calc.py
Created August 21, 2018 14:46
Python implement of calculator
op_weight = {op: i for i, op in enumerate("+-*/^")}
op_weight['-'] = op_weight['+']
op_weight['/'] = op_weight['*']
def parse_word(s: str):
int_mode = True
num_val = ""
for ch in s:
# parse operator