(Python 3: replace raw_input()
with input()
)
1st number: 7
2nd number: 3
Operation (+-*/%): +
7 + 3 = 10
done using raw_input()
thrice, and an if-elif-elif-elif-elif-else tree
Type an expression in format A # B (where # is an operator, one of +-*/%)
> 7 + 3
10
done using raw_input()
once, str.split()
and the same tree as above
Optimize by using a dict of operators (import operator)
Come up with other ideas.