all test passed!
This commit is contained in:
parent
deb5be0955
commit
ab8b80758c
@ -102,11 +102,11 @@ def in2post_fix(infix_tokens):
|
||||
@param infix_tokens: the infix list of tokens to transform into postfix form.
|
||||
@return: the corresponding postfix list of tokens.
|
||||
|
||||
>>> in2post_fix([op.par, 2, op.add, 5, op.sub, 1, ')', op.div, op.par, 3, op.mul, 4, ')'])
|
||||
>>> in2post_fix(['(', 2, '+', 5, '-', 1, ')', '/', '(', 3, '*', 4, ')'])
|
||||
[2, 5, 1, '-', '+', 3, 4, '*', '/']
|
||||
>>> in2post_fix([op.sub1, op.par, op.sub1, 2, ')'])
|
||||
>>> in2post_fix(['-', '(', '-', 2, ')'])
|
||||
[2, '-', '-']
|
||||
>>> in2post_fix([op.sub1, op.par, op.sub1, 2, op.add, 3, op.mul, 4, ')'])
|
||||
>>> in2post_fix(['-', '(', '-', 2, '+', 3, '*', 4, ')'])
|
||||
[2, '-', 3, 4, '*', '+', '-']
|
||||
"""
|
||||
# Stack where operator will be stocked
|
||||
|
Loading…
Reference in New Issue
Block a user