MCPcopy Create free account
hub / github.com/ndleah/python-mini-project / parse_infix

Function parse_infix

infix_postfix_calculator/main.py:1–13  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

1def parse_infix(input):
2 ret = ""
3 for i, tmp in enumerate(input):
4 if tmp == '.':
5 ret += tmp
6 elif tmp.isdigit():
7 ret += tmp
8 if i < len(input) - 1:
9 if not input[i + 1].isdigit() and input[i + 1] != '.':
10 ret += " "
11 else:
12 ret += tmp + " "
13 return ret
14
15
16def convert_to_postfix(infix):

Callers 1

calculateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected