MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / precedence

Function precedence

data_structures/stacks/infix_to_postfix_conversion.py:28–34  ·  view source on GitHub ↗

Return integer value representing an operator's precedence, or order of operation. https://en.wikipedia.org/wiki/Order_of_operations

(char: str)

Source from the content-addressed store, hash-verified

26
27
28def precedence(char: str) -> int:
29 """
30 Return integer value representing an operator's precedence, or
31 order of operation.
32 https://en.wikipedia.org/wiki/Order_of_operations
33 """
34 return PRECEDENCES.get(char, -1)
35
36
37def associativity(char: str) -> Literal["LR", "RL"]:

Callers 1

infix_to_postfixFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected