python realize the idea of a computer

Calculator # 
# first get a string
# to space
# is no space string
# the first count innermost parentheses: Find brackets, parentheses and brackets are no other
# get a expressions without parentheses: only addition and subtraction multiplication and division
# left to right to locate the first multiplication and division: cycle #
symbol number # of the first multiplication and division are not necessarily matched
# multiplication and division to find out how to calculate it:
# determines a multiplication or division to
# If multiplications to '*' content is obtained by dividing the number of string data type
# If the division is to use '/' is divided content string data type number
after the data type in accordance with rotation # '*', '/' calculation
# results replace the original string contents
# all multiplication and division are done
# calculated addition and subtraction - addition and subtraction
# + + - - + + - should be treated in advance
# calculation process all the numbers are calculated as a floating point number
# the first can be negative
# is only one number on the can end

Guess you like

Origin www.cnblogs.com/CoolClare/p/10973207.html