Re: [Tutor] flow problem with a exercise

2010-08-21 Thread Roelof Wobben
> Subject: Re: [Tutor] flow problem with a exercise > From: evert@gmail.com > Date: Sat, 21 Aug 2010 12:39:05 +0200 > CC: tutor@python.org > To: rwob...@hotmail.com > > > In [39]: t = 3 > > > > In [40]: round((t-32)/1.8) > > Out[40]: -16.0

Re: [Tutor] flow problem with a exercise

2010-08-21 Thread Dave Angel
You need to figure out how to get your email program to do quoting. As it stands, there's no good way to tell what part of the following message was from you, and what part was from wayne, or maybe others. Probably all you need to do is to do a reply-all to the message, and it'll mark the ex

Re: [Tutor] flow problem with a exercise

2010-08-21 Thread Evert Rol
> In [39]: t = 3 > > In [40]: round((t-32)/1.8) > Out[40]: -16.0 > > In [41]: t = 3.0 > > In [42]: round((t-32)/1.8) > Out[42]: -16.0 > > Works fine for me. > > Correct, > But I see one wierd thing. > > round ((42-32)/1.8) gives a output -16.0 but (42-32)/1.8) gives also -16.0 > I was expe

Re: [Tutor] flow problem with a exercise

2010-08-21 Thread Roelof Wobben
From: waynejwer...@gmail.com Date: Fri, 20 Aug 2010 15:07:56 -0500 Subject: Re: [Tutor] flow problem with a exercise To: rwob...@hotmail.com CC: tutor@python.org On Fri, Aug 20, 2010 at 2:48 PM, Roelof Wobben wrote: Oke, I don''t understand it complety. return not arg%2

Re: [Tutor] flow problem with a exercise

2010-08-20 Thread ALAN GAULD
Please use ReplyAll when responding to posts from the tutor list. > I don''t understand it complety. > return not arg%2 >> >> Why use not here ? >> >> I think that arg%2 is True not makes it false. > >For an even number arg % 2 will be 0 which Python considers to be False. So for a True res

Re: [Tutor] flow problem with a exercise

2010-08-20 Thread Wayne Werner
On Fri, Aug 20, 2010 at 2:48 PM, Roelof Wobben wrote: > Oke, > > I don''t understand it complety. > > return not arg%2 > > Why use not here ? > > I think that arg%2 is True not makes it false. > What happens when you replace arg with a value? % is modulo division, so it just returns the remaind

Re: [Tutor] flow problem with a exercise

2010-08-20 Thread Roelof Wobben
Oke, I don''t understand it complety. return not arg%2 Why use not here ? I think that arg%2 is True not makes it false. Another question. How can I round outcome of a calculation. round ( ( t-32)/1.8) does not work because I get a message that there are two arguments. Outcome

Re: [Tutor] flow problem with a exercise

2010-08-20 Thread Alan Gauld
"Roelof Wobben" wrote Others have pointed out the lack of indentation. I'll point out some shortcuts you can use... def is_even(argument): remainder= argument%2 if remainder == 0 : return True else : return False You can abbreviate this to just def is_even(arg): r

Re: [Tutor] flow problem with a exercise

2010-08-19 Thread Dave Angel
Roelof Wobben wrote: def is_odd(argument): uitkomst=is_even(argument) return uitkomst You forgot to indent the return statement to match the other statement(s) in the function. DaveA ___ Tutor maillist - Tutor@python.org To un

Re: [Tutor] flow problem with a exercise

2010-08-19 Thread Alex Hall
On 8/19/10, Roelof Wobben wrote: > > Hello, > > > > I have this exercise: > > > > Now write the function is_odd(n) that returns True when n is odd and False > otherwise. Include doctests for this function as you write it. > Finally, modify it so that it uses a call to is_even to determine if its >

Re: [Tutor] flow problem with a exercise

2010-08-19 Thread Wayne Werner
On Thu, Aug 19, 2010 at 2:01 PM, Roelof Wobben wrote: > > def is_odd(argument): > uitkomst=is_even(argument) > return uitkomst > > even=is_odd(1) ; > if even==True : > print "Even getal" > if even==False: > print "Oneven getal" > > > But now I get this error message : > > return uitkomst

Re: [Tutor] flow problem with a exercise

2010-08-19 Thread Joel Goldstick
On Thu, Aug 19, 2010 at 3:01 PM, Roelof Wobben wrote: > Hello, > > I have this exercise: > > > Now write the function is_odd(n) that returns True when n is odd and > Falseotherwise. Include doctests for this function as you write it. > Finally, modify it so that it uses a call to is_even to det

[Tutor] flow problem with a exercise

2010-08-19 Thread Roelof Wobben
Hello, I have this exercise: Now write the function is_odd(n) that returns True when n is odd and False otherwise. Include doctests for this function as you write it. Finally, modify it so that it uses a call to is_even to determine if its argument is an odd integer. So I thought of