> 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
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
> 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
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
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
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
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
"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
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
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
>
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
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
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
13 matches
Mail list logo