# L-15 MCS 260 Mon 15 Feb 2010 : apply # # apply() in a simple calculator # from operator import add, sub, mul ops = { '+':add, '-':sub, '*': mul } a = input('give first operand : ') b = input('give second operand : ') op = raw_input('operator ? (+,-,*) ') c = apply(ops[op],(a,b)) print '%d %s %d = %d' % (a,op,b,c)