[Tutor] flow problem with a exercise

Alan Gauld alan.gauld at btinternet.com
Fri Aug 20 10:16:57 CEST 2010

"Roelof Wobben" <rwobben at hotmail.com> 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):
    return not arg%2

def is_odd(argument):
return uitkomst

and this to:

def is_odd(arg):
   return not is_even(arg)


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list