On 14/08/2014 08:32, luofeiyu wrote:
I want to write a function to make operation as a argument in the function.|def fun(op,x,y): return(x op y)| it is my target for the funciton: if op ="+" fun(op,3,9) =12 if op ="*" fun(op,3,9) =27 How to write it?
With a text editor after you've taken the trouble to read the docs instead of bombarding us with your questions. Start here https://docs.python.org/3/library/operator.html#module-operator
As a slight aside would you stop top posting as well. If you have the audacity to ask what that means rather than search I will be sending my boys around. Please be aware, the 17 year old is a very, very vicious thug. He was taught by his granddad, who used to work for the Piranha Brothers, see http://en.wikipedia.org/wiki/Piranha_Brothers :)
-- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
