mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-25 10:28:39 +00:00
postfix_evaluation.py now supports Unary operators and floating point numbers. Also merged evaluate_postfix_notations.py and postfix_evaluation.py into postfix_evaluation.py which fixes #8724. Added a doctest example with unary operator.
This commit is contained in:
parent
d6874ad24f
commit
b4521ea28f
@ -88,6 +88,8 @@ def evaluate(post_fix: list[str], verbose: bool = False) -> int | float | str |
|
||||
6.6
|
||||
>>> evaluate(["2", "-", "3", "+"])
|
||||
1
|
||||
>>> evaluate(["-4", "5", "*", "6", "-"])
|
||||
-26
|
||||
>>> evaluate([])
|
||||
0
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user