Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76283 > unrolled thread
| Started by | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| First post | 2014-08-14 09:52 +0100 |
| Last post | 2014-08-14 09:52 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: how to write a function to make operation as a argument in the function Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-14 09:52 +0100
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2014-08-14 09:52 +0100 |
| Subject | Re: how to write a function to make operation as a argument in the function |
| Message-ID | <mailman.12984.1408006368.18130.python-list@python.org> |
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
Back to top | Article view | comp.lang.python
csiph-web