assign operator to variable in python?
- by abhilashm86
Usual method of applying mathematics to variables is
a * b
Is it able to calculate and manipulate two operands like this?
a = input('enter a value')
b = input('enter a value')
op = raw_input('enter a operand')
then how do i connect op and two variables a and b?? i know i can compare op to +, -, %, $ and then assign and compute....
but can i do something like a op b ,
how to tell compiler that op is an operator?? any tweaks possible?