Re: easy question, how to double a variable

2009-12-28 Thread Tom Kermode
def twice(parameter = 2) return 4 2009/9/20 daggerdvm : >  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 > -- > http://mail.python.org/mailman/listinfo/python-list > -- http

Re: easy question, how to double a variable

2009-10-02 Thread Chris Colbert
I come from a scientific background, so my approach to the solution of this problem is a little different. It makes use of some numerical approximations, but that's not necessarily a bad thing, because it helps avoid singularities. So it could be a little more robust than other solutions presented

Re: easy question, how to double a variable

2009-10-02 Thread Albert van der Horst
In article , daggerdvm wrote: >you brain needs error checking! Whose brain? At least I know this: Your brain is beyond repair. Go for a brain transplant. Groetjes Albert -- -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. alb...@spe

Re: easy question, how to double a variable

2009-09-24 Thread devilkin
On 9月22日, 上午4时49分, daggerdvm wrote: > you brain needs error checking! this kid knows error checking...may be he know exceptions as well -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question, how to double a variable

2009-09-24 Thread Pablo Torres N.
On Sep 24, 5:51 am, Iain King wrote: > On Sep 23, 7:36 pm, David C Ullrich wrote: > > > > > On Tue, 22 Sep 2009 02:34:53 +, Steven D'Aprano wrote: > > > On Mon, 21 Sep 2009 13:50:23 -0500, David C Ullrich wrote: > > > >> But you actually want to return twice the value. I don't see how to do >

Re: easy question, how to double a variable

2009-09-24 Thread Iain King
On Sep 23, 7:36 pm, David C Ullrich wrote: > On Tue, 22 Sep 2009 02:34:53 +, Steven D'Aprano wrote: > > On Mon, 21 Sep 2009 13:50:23 -0500, David C Ullrich wrote: > > >> But you actually want to return twice the value. I don't see how to do > >> that. > > > What? > > > Seriously? > > You're sa

Re: easy question, how to double a variable

2009-09-23 Thread David C Ullrich
On Tue, 22 Sep 2009 02:34:53 +, Steven D'Aprano wrote: > On Mon, 21 Sep 2009 13:50:23 -0500, David C Ullrich wrote: > >> But you actually want to return twice the value. I don't see how to do >> that. > > What? > > Seriously? You're saying it _can_ be done in Python? They must have added

Re: easy question, how to double a variable

2009-09-23 Thread Brian Blais
On Sep 23, 2009, at 8:15 , Casey Webster wrote: Btw, I can't believe nobody provided the simplest literal solution: def twice(i): return i, i -- or this one, which is possibly even more literal: def twice(p): return "an int that is twice the value of the parameter" twice("an int par

Re: easy question, how to double a variable

2009-09-23 Thread Casey Webster
On Sep 22, 9:57 am, Grant Edwards wrote: > > No, no, no.  The plan is to do his homework for him so that > he's incompetent when he graduates and won't be competition for > the rest of us who did do our homework. Don't forget the Peter principal --- we might end up working for him! Btw, I can't

Re: easy question, how to double a variable

2009-09-23 Thread Steven D'Aprano
On Tue, 22 Sep 2009 07:41:11 -0700, Hyuga wrote: >> > Forget ethical.  We can do his homework for him, we can perhaps pass >> > exams for him, maybe graduate for him, and then with our luck, he'll >> > get a job in our office and we get to do his work for him. >> >> No, no, no.  The plan is to do

Re: easy question, how to double a variable

2009-09-23 Thread Rhodri James
On Mon, 21 Sep 2009 21:49:50 +0100, daggerdvm wrote: you brain needs error checking! Your post, by contrast, needs grammar checking. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question, how to double a variable

2009-09-22 Thread Xavier Ho
On Tue, Sep 22, 2009 at 11:58 PM, Mahmoud Abdelkader wrote: > hi looking for help catching up in a class and overall to get me better > than i am now. I can pay you by the week or per hour. > Wow. I'd feel guilty getting paid doing that. Sounds all too easy. I hope he is actually learning, not j

Re: easy question, how to double a variable

2009-09-22 Thread Hyuga
On Sep 22, 9:57 am, Grant Edwards wrote: > On 2009-09-22, Mel wrote: > > > Tim Roberts wrote: > > >> daggerdvm wrote: > > >>>carl banks.you are a dork > > >> What are you, eleven years old? > > >> Look, you asked us to answer for you what is CLEARLY a homework question. > >> It is unethi

Re: easy question, how to double a variable

2009-09-22 Thread Grant Edwards
On 2009-09-22, Mel wrote: > Tim Roberts wrote: > >> daggerdvm wrote: >>> >>>carl banks.you are a dork >> >> What are you, eleven years old? >> >> Look, you asked us to answer for you what is CLEARLY a homework question. >> It is unethical for you to ask that, and it is unethical for us

Re: easy question, how to double a variable

2009-09-22 Thread Mahmoud Abdelkader
http://codingforums.com/showthread.php?s=e26b8b0aabc69745ef24a855b1a0fc83&t=177529 It seems that this dude really is looking for how to double a variable... """ hi looking for help catching up in a class and overall to get me better than i am now. I can pay you by the week or per hour. everythin

Re: easy question, how to double a variable

2009-09-22 Thread Ben Finney
Mel writes: > Tim Roberts wrote: > > Look, you asked us to answer for you what is CLEARLY a homework > > question. It is unethical for you to ask that, and it is unethical > > for us to answer it. > > Forget ethical. We can do his homework for him, we can perhaps pass > exams for him, maybe gradu

Re: easy question, how to double a variable

2009-09-22 Thread Mel
Tim Roberts wrote: > daggerdvm wrote: >> >>carl banks.you are a dork > > What are you, eleven years old? > > Look, you asked us to answer for you what is CLEARLY a homework question. > It is unethical for you to ask that, and it is unethical for us to answer > it. Forget ethical. We c

Re: easy question, how to double a variable

2009-09-22 Thread koranthala
On Sep 21, 1:27 am, 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 Please note that most mails here are humorous - as should be expected for a language named af

Re: easy question, how to double a variable

2009-09-22 Thread Donn
On Monday 21 September 2009 22:49:50 daggerdvm wrote: > you brain needs error checking! try: return response() except Troll,e: raise dontFeed(anymore=True) \d -- home: http://otherwise.relics.co.za/ 2D vector animation : https://savannah.nongnu.org/projects/things/ Font manager : https://savann

Re: easy question, how to double a variable

2009-09-22 Thread Andreas Waldenburger
On Mon, 21 Sep 2009 13:46:31 -0700 (PDT) daggerdvm wrote: > u don't want to answerthen why post?...get lost. You're not doing yourself a favor with this attitude, much less displaying it. You asked a question that you could have solved with 1 hour's worth of reading at most (much

Re: easy question, how to double a variable

2009-09-22 Thread daggerdvm
you brain needs error checking! -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question, how to double a variable

2009-09-22 Thread Tim Chase
daggerdvm wrote: what are you retarded? this is not a test you moron, i can ask all the questions i want about it. You seem to have forgotten to CC the list. Let me help show the world your "mad skillz" -- at replying, at programming, at orthography, at interpersonal communication... Sur

Re: easy question, how to double a variable

2009-09-22 Thread Hendrik van Rooyen
On Monday, 21 September 2009 22:50:31 daggerdvm wrote: > carl banks.you are a dork No mister_do_my_homework, he is not. He is actually a respected member of this little community. You, however, are beginning to look like one. Why do you not come clean - tell us what you are doing, sho

Re: easy question, how to double a variable

2009-09-21 Thread Processor-Dev1l
On Sep 20, 10:27 pm, 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 I will stop this theatre... as you should know, you want your function to make arithmetic op

Re: easy question, how to double a variable

2009-09-21 Thread Tim Roberts
daggerdvm wrote: > >carl banks.you are a dork What are you, eleven years old? Look, you asked us to answer for you what is CLEARLY a homework question. It is unethical for you to ask that, and it is unethical for us to answer it. As others have said, show us what you TRIED, and we can h

Re: easy question, how to double a variable

2009-09-21 Thread Grant Edwards
On 2009-09-21, David C Ullrich wrote: > On Sun, 20 Sep 2009 13:27:07 -0700, 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 > > I don't think this can be done

Re: easy question, how to double a variable

2009-09-21 Thread Tim Chase
But you actually want to return twice the value. I don't see how to do that. Ah, I think I see...returning more than once is done with the "yield" keyword: def f(param): yield param yield param That returns twice the integer parameter... :-D However, the OP was instructed to "Wri

Re: easy question, how to double a variable

2009-09-21 Thread Steven D'Aprano
On Mon, 21 Sep 2009 13:50:23 -0500, David C Ullrich wrote: > But you actually want to return twice the value. I don't see how to do > that. What? Seriously? You're not just yanking the OP's chain??? -- Steven who normally does quite well detecting sarcasm in writing -- http://mail.python.org

Re: easy question, how to double a variable

2009-09-21 Thread Sean DiZazzo
On Sep 21, 1:46 pm, daggerdvm wrote: > u don't want to answerthen why post?...get lost. I eat children... -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question, how to double a variable

2009-09-21 Thread Ethan Furman
daggerdvm wrote: u don't want to answerthen why post?...get lost. On the contrary! We *do* want to answer. Prizes are awarded based on the most outlandish yet correct answer, on the most literal answer, and on the funniest answer! Ridiculous questions like yours are what m

Re: easy question, how to double a variable

2009-09-21 Thread daggerdvm
carl banks.you are a dork -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question, how to double a variable

2009-09-21 Thread daggerdvm
u don't want to answerthen why post?...get lost. -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question, how to double a variable

2009-09-21 Thread David C Ullrich
On Sun, 20 Sep 2009 13:27:07 -0700, 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 I don't think this can be done in Python. Looking at the Subject line I though

Re: easy question, how to double a variable

2009-09-21 Thread Tim Chase
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

Re: easy question, how to double a variable

2009-09-21 Thread Carl Banks
On Sep 20, 1:27 pm, 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 Simple: Once you define the function, "copy" it using your editor commands, then "paste" it

Re: easy question, how to double a variable

2009-09-20 Thread Xavier Ho
On Mon, Sep 21, 2009 at 6:27 AM, 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 > I thought it was easier to implement this twice function than to find this ma

Re: easy question, how to double a variable

2009-09-20 Thread Steven D'Aprano
On Sun, 20 Sep 2009 13:27:07 -0700, 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 Yes, that certainly is an easy question. Here's my solution: class Multiplier

Re: easy question, how to double a variable

2009-09-20 Thread Tim Chase
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

Re: easy question, how to double a variable

2009-09-20 Thread MRAB
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 That's a very basic question. Try a tutorial. -- http://mail.python.org/mailman/listinfo/python-list

easy question, how to double a variable

2009-09-20 Thread daggerdvm
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 -- http://mail.python.org/mailman/listinfo/python-list