N
nghoffma
Is it cheating to use a Set?
py>>def doit(thelist):
.... s = sets.Set(thelist)
.... if s == sets.Set([None]):
.... return None
.... else:
.... return max(s)
....
py>>print doit([ True , None , None , False ] )
True
py>>print doit([ None , False , False , None ] )
False
py>>print doit([ False , True , True , True ] )
True
py>>print doit( [None, None, None, None] )
None
py>>def doit(thelist):
.... s = sets.Set(thelist)
.... if s == sets.Set([None]):
.... return None
.... else:
.... return max(s)
....
py>>print doit([ True , None , None , False ] )
True
py>>print doit([ None , False , False , None ] )
False
py>>print doit([ False , True , True , True ] )
True
py>>print doit( [None, None, None, None] )
None