easy question, how to double a variable
Tim Chase
python.list at tim.thechases.com
Sun Sep 20 17:00:24 EDT 2009
daggerdvm wrote:
> Write the definition of a function twice , that receives an int
> parameter and returns an int that is twice the value of the
> parameter.
>
> how can i do this
Read over your textbook and the notes you took in class -- I'm
sure therein you'll find how to define functions, how to specify
parameters, how to return values, and how to do basic arithmetic
operations. You can also hit up python.org and
diveintopython.org for more reading if you need.
I'll give you a hint: If you use
twice = lambda x: int(x**2/(0.5*x))
I suspect your professor will flunk you for cheating.
-tkc
More information about the Python-list
mailing list