assign operator to variable in python?

Posted by abhilashm86 on Stack Overflow See other posts from Stack Overflow or by abhilashm86
Published on 2010-06-06T04:55:04Z Indexed on 2010/06/06 5:02 UTC
Read the original article Hit count: 345

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about python

Related posts about beginner