This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |