Python presentations

Alexander Blinne news at blinne.net
Mon Sep 17 04:39:17 EDT 2012


On 16.09.2012 19:35, Steven D'Aprano wrote:
> On Sun, 16 Sep 2012 18:13:36 +0200, Alexander Blinne wrote:
>> def powerlist2(x,n):
>>     if n==1:
>>         return [1]
>>     p = powerlist3(x,n-1)
>>     p.append(p[-1]*x)
>>     return p
> 
> Is that a typo? I think you mean to make a recursive call to powerlist2, 
> not a non-recursive call to powerlist3.

Yes, it is a typo. I originally tested 2 more versions, but tried to
change the numbering before posting. Bad idea :)



More information about the Python-list mailing list