[Tutor] catching the row that raises IntegrityError in sqlite

2014-02-08 Thread Sivaram Neelakantan
I've written this code that seems to work and I'd like to know how to get the record that causes the abort. Apparently 'executemany' doesn't support lastrow? And if it doesn't, any suggestions? --8<---cut here---start->8--- def table_load(datafile,name,conn,d

Re: [Tutor] learning recursion

2014-02-08 Thread Mark Lawrence
On 08/02/2014 10:06, rakesh sharma wrote: Please do not top post on this list. I got my definition wrong the code should be more like this def fib(n): if n==0: return What does the above line return? As others have already said what happens if n is negative? elif n==1: return 1 elif n=

Re: [Tutor] learning recursion

2014-02-08 Thread rakesh sharma
I got my definition wrong the code should be more like this def fib(n): if n==0:return elif n==1: return 1elif n==2: return 1else: return fib(n-2) + fib(n-1) thanks,rakesh > Date: Fri, 7 Feb 2014 21:40:49 -0800 > Subject: Re

Re: [Tutor] learning recursion

2014-02-08 Thread rakesh sharma
Hi I guess I need to revisit my maths lessons.Thank you for correcting me. thanks,rakesh > From: d...@hashcollision.org > Date: Sat, 8 Feb 2014 00:20:19 -0800 > Subject: Re: [Tutor] learning recursion > To: rakeshsharm...@hotmail.com > CC: da...@davea.name; tutor@python.org > > On Fri, Feb 7, 20

Re: [Tutor] learning recursion

2014-02-08 Thread Danny Yoo
On Fri, Feb 7, 2014 at 9:05 PM, rakesh sharma wrote: > Hi > > Shouldn't your code be like this > > def fib(n): > if n==0: > return 0 > else: > return n + fib(n-1) Hi Rakesh, Unfortunately, no, because this computes a slightly different function: the triangular numbers! :P That is, your funct