TypeError, I know why but not how!?

ssecorp circularfunc at gmail.com
Thu Jul 10 09:15:49 EDT 2008


I don't fully understand why I have to do this.


On Jul 10, 4:17 am, Robert Kern <robert.k... at gmail.com> wrote:
> ssecorp wrote:
> > Im looking into PvsNP:
> >http://www.claymath.org/millennium/P_vs_NP/
> > so I thought I'd write the program just to get a feel for it.
>
> > But I run into a problem. Why does it all the sudden return None? I
> > mean I know why the program aborts but I dont understand why the None
> > is generated all the sudden. Hitting recursion depth isn't reported
> > with that error.
>
> def validate(placed):
>      student = round(random.random()*401)
>      if student in placed:
>          # You need to explicitly return, here:
>          return validate(placed)
>      else:
>          placed.append(student)
>          return student, placed
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless enigma
>   that is made terrible by our own mad attempt to interpret it as though it had
>   an underlying truth."
>    -- Umberto Eco




More information about the Python-list mailing list