This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ORD_OF_ZERO = ord('0') | |
def _eval(str): | |
''' Returns an integer, a result of evaluation of a nonempty str | |
that may contain only '0'..'9', '+', '*'. | |
Summary of the algorithm: | |
* .split('+') the string into products (strings), | |
* then .split('*') each product string into numbers (strings), | |
* evaluate each number (string) into an integer, | |
* multiply all numbers within each product to get the numerical product, |