Recursive function won't compile

Keith Thompson kst-u at mib.org
Wed Apr 2 23:09:17 EDT 2008


"Diez B. Roggisch" <deets at nospam.web.de> writes:

>> #include <stdio.h>
>> #include <stdlib.h>
>>
>> def RecursiveFact(n):
>>     if(n>1):
>>         return n*RecursiveFact(n-1)
>>     else:
>>         return 1
>>
>> fact = RecursiveFact(31)
>> print fact
>>
>> fact = "End of program"
>> print fact
>>
>>
>> ......but yet it still gives the right answer. How is this possible?
>
> Given that you obviously don't use python, but some weird cross-breed
> beteween python and C - who are we to judge the semantics of that
> chimera?

What do you mean?  Aren't these:

    #include <stdio.h.
    #include <stdlib.h>

perfectly valid comments in Python?

Followups redirected.

-- 
Keith Thompson (The_Other_Keith) <kst-u at mib.org>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"



More information about the Python-list mailing list