[Tutor] flow problem with a exercise

ALAN GAULD alan.gauld at btinternet.com
Fri Aug 20 23:53:20 CEST 2010


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 result when arg%2 is zero, you must negate the logic

  

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.
>
>Check your code because thre is only one arg here. Therefore the actual code 
giving the error must be different in some way.


Outcome = (t-32)/1.8
>outcome2 = round (outcome) does not work because the argument must be a string 
>or a number 
>
>
>
Assuming t is a number the outcome will be a number so it should work.

It helps if you cut n paste the real code and the real error message, 
do not just summarise. Python error messages are extremely helpful, 
but only if we can see them.

Alan G.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100820/8574bbb2/attachment-0001.html>


More information about the Tutor mailing list