mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9 * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -1,5 +1,3 @@
|
||||
from typing import Any, List
|
||||
|
||||
"""
|
||||
The Reverse Polish Nation also known as Polish postfix notation
|
||||
or simply postfix notation.
|
||||
@ -8,6 +6,9 @@ Classic examples of simple stack implementations
|
||||
Valid operators are +, -, *, /.
|
||||
Each operand may be an integer or another expression.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
def evaluate_postfix(postfix_notation: list) -> int:
|
||||
@ -23,7 +24,7 @@ def evaluate_postfix(postfix_notation: list) -> int:
|
||||
return 0
|
||||
|
||||
operations = {"+", "-", "*", "/"}
|
||||
stack: List[Any] = []
|
||||
stack: list[Any] = []
|
||||
|
||||
for token in postfix_notation:
|
||||
if token in operations:
|
||||
|
Reference in New Issue
Block a user