Steven D'Aprano 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

Yes, that certainly is an easy question.

Here's my solution:

class MultiplierFactory(object):
[snip a marvel of abstruse code]

twice = MultiplierFactory(2)()

It needs some error checking, but otherwise should work.

Tsk...no docstrings? no unit tests or doctests? no parameter validation? no copyright notice? no revision-tracking nor authorship comments? what sort of bad example are you setting here? You want this kid to fail?! With such poor instruction, it's no wonder the economy is going to shambles, the educational system is falling apart, there's global warming, terrorism, spam, and reality television. Your piteous code make Paris Hilton cry. [shakes head in disappointment]

;-)

-tkc





--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to