Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76279

how to write a function to make operation as a argument in the function

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <elearn2014@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.051
X-Spam-Evidence '*H*': 0.90; '*S*': 0.00; 'argument': 0.05; 'def': 0.12; 'subject:make': 0.16; 'header:User-Agent:1': 0.23; 'function': 0.29; 'subject:the': 0.34; 'received:google.com': 0.35; 'received:10': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=rqgbYB2Us7DQmuWvouVPK8lxUQIoaNRKIxeMJK9OjMs=; b=wP45Wqq6vbXEodCas7JaN2HKQrDnvFCi/I0fYVuJKBxhnshdOmX8kaIb1Qn/roD5ji Lj0MPRcZfqlEoHQzLcZjowpsiNKiDrx/WYDaS8mqzJnn/Yp0XtTuQ4fedXNrD1EBBGmq tHQnlGU6kmaYIYI73zRXKIf447zslKk76lqhBskFeIGLK6sguXXWhG+SLa9Z03GCA7he p39u7GGd8O5xqgToiPt0gmVglTChCIR8BPIMmS834uQVl2xmsauWqcnUQ6v1uMYZwQoA Ck0etJSBBm/s8xhEcGFH/eASOcobKK0wayoVcpfvYDvDzs66gvflFbUYzlX26aZpANiZ kQcg==
X-Received by 10.67.1.195 with SMTP id bi3mr2573320pad.74.1408001548186; Thu, 14 Aug 2014 00:32:28 -0700 (PDT)
Date Thu, 14 Aug 2014 15:32:19 +0800
From luofeiyu <elearn2014@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0
MIME-Version 1.0
To python-list@python.org
Subject how to write a function to make operation as a argument in the function
Content-Type multipart/alternative; boundary="------------060800050800060200020407"
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.12980.1408002867.18130.python-list@python.org> (permalink)
Lines 43
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1408002867 news.xs4all.nl 2934 [2001:888:2000:d::a6]:56907
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76279

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

how to write a function to make operation as a argument in the function luofeiyu <elearn2014@gmail.com> - 2014-08-14 15:32 +0800

csiph-web