[Tutor] self keyword in recursive function

2014-05-30 Thread Ritwik Raghav
I joined the topcoder community tomorrow and tried solving the PersistentNumber problem: Given a number x, we can define p(x) as the product of the digits of x. We can then form a sequence x, p(x), p(p(x))... The persistence of x is then defined as the index (0-based) of the first single digit

Re: [Tutor] self keyword in recursive function

2014-05-30 Thread Alan Gauld
On 30/05/14 14:14, Ritwik Raghav wrote: I joined the topcoder community tomorrow and tried solving the PersistentNumber problem: Time travel! I love it already... :-) 8*1 = 8. Thus, the persistence of 99 is 2. You will be given n, and you must return its persistence. It asks to define a

Re: [Tutor] self keyword in recursive function

2014-05-30 Thread Peter Otten
Ritwik Raghav wrote: I joined the topcoder community tomorrow and tried solving the PersistentNumber problem: Given a number x, we can define p(x) as the product of the digits of x. We can then form a sequence x, p(x), p(p(x))... The persistence of x is then defined as the index (0-based) of

[Tutor] Library for .ppt to .txt conversion

2014-05-30 Thread Aaron Misquith
Like pypdf is used to convert pdf to text; is there any library that is used in converting .ppt files to .txt? Even some sample programs will be helpful. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] Library for .ppt to .txt conversion

2014-05-30 Thread Marc Tompkins
On Fri, May 30, 2014 at 2:41 AM, Aaron Misquith aaronmisqu...@gmail.com wrote: Like pypdf is used to convert pdf to text; is there any library that is used in converting .ppt files to .txt? Even some sample programs will be helpful. I suspect you'd need to use PowerPoint itself to do that

[Tutor] Question about scraping

2014-05-30 Thread Matthew Ngaha
Hey all. I've been meaning to get into web scraping and was pointed to the directions of lxml (library) and scrapy (framework). Can I ask in terms of web scraping, what's the difference between a library and a framework? Surely everyone should use a framework but I get the idea more people use the

Re: [Tutor] Question about scraping

2014-05-30 Thread Alan Gauld
On 30/05/14 18:25, Matthew Ngaha wrote: Hey all. I've been meaning to get into web scraping and was pointed to the directions of lxml (library) and scrapy (framework). Can I ask in terms of web scraping, what's the difference between a library and a framework? I don;t know of anything web

Re: [Tutor] Library for .ppt to .txt conversion

2014-05-30 Thread Alan Gauld
On 30/05/14 10:41, Aaron Misquith wrote: Like pypdf is used to convert pdf to text; is there any library that is used in converting .ppt files to .txt? Even some sample programs will be helpful. Bearing in mind that Powerpoint is intended for graphical presentations the text elements are not

Re: [Tutor] Question about scraping

2014-05-30 Thread ALAN GAULD
On Fri, May 30, 2014 at 7:20 PM, Alan Gauld alan.ga...@btinternet.com wrote: If a site offers an API that returns the data you need then use it, If not you have few alternatives to scraping (although scraping may be 'illegal' anyway due to the impact on other users). But scraping, whether a

Re: [Tutor] Question about scraping

2014-05-30 Thread Matthew Ngaha
Thanks for the response Alan. I forgot to reply to tutor on my 2nd comment. Just incase someone might want to see it, here it is: Okay I think learning how to scrap (library or framework) is not worth the trouble. Especially if some people consider it illegal. Thanks for the input.

Re: [Tutor] self keyword in recursive function

2014-05-30 Thread Ritwik Raghav
Alan Gauld wrote: On 30/05/14 14:14, Ritwik Raghav wrote: I joined the topcoder community tomorrow and tried solving the PersistentNumber problem: Time travel! I love it already... :-) 8*1 = 8. Thus, the persistence of 99 is 2. You will be given n, and you must return its persistence. It

Re: [Tutor] self keyword in recursive function

2014-05-30 Thread Ritwik Raghav
Peter Otten wrote: Ritwik Raghav wrote: I joined the topcoder community tomorrow and tried solving the PersistentNumber problem: Given a number x, we can define p(x) as the product of the digits of x. We can then form a sequence x, p(x), p(p(x))... The persistence of x is then defined as

Re: [Tutor] self keyword in recursive function

2014-05-30 Thread Marc Tompkins
On Fri, May 30, 2014 at 10:16 PM, Ritwik Raghav ritwikragha...@gmail.com wrote: It has again given some error I do not understand. This time my code is: count = 0 def getPersistence(self,n): product = 1 if len(str(n)) == 1: return self.count else: a = str(n)