[Tutor] Handling 'None' (null) values when processing sqlite cursor results

2010-07-13 Thread Monte Milanuk
Hello all, I'm struggling a bit trying to find the right way to deal with null values in my sqlite database when querying it and processing the results in python. If my cursor.fetchall() results return the following: (104, None, u'Sylvester', None, u'Evans', None, u'527-9210 Proin Av.', u'L

Re: [Tutor] Help

2010-07-13 Thread Shashwat Anand
On Tue, Jul 13, 2010 at 3:20 PM, Dipo Elegbede wrote: > I was trying to write a code that prints prime numbers between 1 and 20. > > I have by myself seen that something is wrong with my code and also my > brain. > > Could anyone be kind enough to tell me what to do > > Where I am confused is

Re: [Tutor] Help

2010-07-13 Thread bob gailer
On 7/13/2010 5:50 AM, Dipo Elegbede wrote: I was trying to write a code that prints prime numbers between 1 and 20. Other suggestions - you need only test divisors up to the square root of the candidate. - you can easily eliminate all even numbers and numbers divisible by 3. for i in range(0,

Re: [Tutor] Path?

2010-07-13 Thread Jim Byrnes
Adam Bark wrote: If I use the terminal to start the program it has no problem using the file. There are multiple files in multiple directories so I was looking for a way to just double click them and have them run. If it turns out that I must make changes to or for each of the files it will

Re: [Tutor] Response to responses about list of lists: a meta exercise in mailinglist recursion

2010-07-13 Thread Steven D'Aprano
On Tue, 13 Jul 2010 10:40:44 pm Siren Saren wrote: > I'm not sure if there's a way to submit responses 'live' or > whether it's better to respond to subthreads at once or together, so > I'll err on the side of discretion and just send one response.  Generally it's better, or at least more common,

Re: [Tutor] Path?

2010-07-13 Thread Adam Bark
On 13 July 2010 23:27, Jim Byrnes wrote: > Adam Bark wrote: > >> On 13 July 2010 14:43, Jim Byrnes wrote: >> >> Steven D'Aprano wrote: >>> >>> My apologizes to Steven and the list, when I replied originally I messed >>> up >>> and sent it to him privately which was not my intention. >>> >>> >>>

Re: [Tutor] Path?

2010-07-13 Thread Jim Byrnes
Adam Bark wrote: On 13 July 2010 14:43, Jim Byrnes wrote: Steven D'Aprano wrote: My apologizes to Steven and the list, when I replied originally I messed up and sent it to him privately which was not my intention. On Mon, 12 Jul 2010 03:42:28 am Jim Byrnes wrote: I am running Ubuntu. I

Re: [Tutor] Response to Alan re: list of lists response

2010-07-13 Thread Alan Gauld
"Siren Saren" wrote unrelated thanks: your website has been a great help Thanks for the kind words :-) The idea of making this into an object appeals to me very much, because I've been trying to get my head around creating objects as well as just using them. It has some advantages since i

Re: [Tutor] Response to responses about list of lists: a meta exercise in mailinglist recursion

2010-07-13 Thread David Hutto
On Tue, Jul 13, 2010 at 1:20 PM, David Hutto wrote: > > > On Tue, Jul 13, 2010 at 8:40 AM, Siren Saren wrote: > >> I'm not sure if there's a way to submit responses 'live' or whether it's >> better to respond to subthreads at once or together, so I'll err on the side >> of discretion and just s

Re: [Tutor] Response to responses about list of lists: a meta exercise in mailinglist recursion

2010-07-13 Thread David Hutto
On Tue, Jul 13, 2010 at 8:40 AM, Siren Saren wrote: > I'm not sure if there's a way to submit responses 'live' or whether it's > better to respond to subthreads at once or together, so I'll err on the side > of discretion and just send one response. Thanks to each of you who tried > to help me.

Re: [Tutor] Help

2010-07-13 Thread bob gailer
You have gotten good advice from others. My request is that you provide a meaningful subject when you post a question. We track by subject. "Help" is not the best subject. Better would be "How to find prime numbers" -- Bob Gailer 919-636-4239 Chapel Hill NC __

Re: [Tutor] LOCATION ISSUES

2010-07-13 Thread Emile van Sebille
On 7/12/2010 11:52 PM Dipo Elegbede said... Which is what it will do when python is started from that directory. I actually found the copies that were made by the code in the same directory but found out that they all had a .thumbnail ext which would not open and it is understandable. I have h

Re: [Tutor] Response to responses about list of lists: a meta exercise in mailinglist recursion

2010-07-13 Thread Stefan Behnel
Siren Saren, 13.07.2010 14:40: I'm not sure if there's a way to submit responses 'live' or whether it's better to respond to subthreads at once or together, so I'll err on the side of discretion and just send one response. It's not generally a problem to send one response like this regarding ma

Re: [Tutor] Path?

2010-07-13 Thread Adam Bark
On 13 July 2010 14:43, Jim Byrnes wrote: > Steven D'Aprano wrote: > > My apologizes to Steven and the list, when I replied originally I messed up > and sent it to him privately which was not my intention. > > > > > On Mon, 12 Jul 2010 03:42:28 am Jim Byrnes wrote: > >> I am running Ubuntu. I dow

Re: [Tutor] Path?

2010-07-13 Thread Jim Byrnes
Steven D'Aprano wrote: My apologizes to Steven and the list, when I replied originally I messed up and sent it to him privately which was not my intention. > On Mon, 12 Jul 2010 03:42:28 am Jim Byrnes wrote: >> I am running Ubuntu. I downloaded the source code examples for a >> book I purcha

[Tutor] random graph

2010-07-13 Thread Robert Johansson
Dear all, I'm trying to check the size of a component in a random graph with this code (by a component I mean a maximal connected sub graph): http://pastebin.com/SzC77HdU I'm not 100 % sure that the code is working as it should but my question is if there is a better way to design the w

[Tutor] Response to Alan re: list of lists response

2010-07-13 Thread Siren Saren
Alan, Your message appeared on the forum right as I posted my response.  Brief unrelated thanks: your website has been a great help to me as I've been learning python.  I'm especially grateful to you for making it so easy to download in various formats, since my health problems make it hard for

[Tutor] Response to responses about list of lists: a meta exercise in mailinglist recursion

2010-07-13 Thread Siren Saren
I'm not sure if there's a way to submit responses 'live' or whether it's better to respond to subthreads at once or together, so I'll err on the side of discretion and just send one response.  Thanks to each of you who tried to help me.  I've responded individually below. To summarize the

Re: [Tutor] Help

2010-07-13 Thread Dave Angel
Dipo Elegbede wrote: I was trying to write a code that prints prime numbers between 1 and 20. I have by myself seen that something is wrong with my code and also my brain. Could anyone be kind enough to tell me what to do Where I am confused is how to test for other numbers without one and

Re: [Tutor] Help

2010-07-13 Thread Nitin Pawar
Adding to what Andre said, another way of optimizing the problem would be storing the prime number in the range you want to check an array and see if the given number is divisible by any of those prime number This improves the performance. Thanks, nitin On Tue, Jul 13, 2010 at 3:52 PM, Andre En

Re: [Tutor] Help

2010-07-13 Thread Andre Engels
On Tue, Jul 13, 2010 at 11:50 AM, Dipo Elegbede wrote: > I was trying to write a code that prints prime numbers between 1 and 20. > > I have by myself seen that something is wrong with my code and also my > brain. > > Could anyone be kind enough to tell me what to do > > Where I am confused is

Re: [Tutor] Help

2010-07-13 Thread Nitin Pawar
Hi, You have two different problems 1) Easiest algorithm to find a prime number 2) and then coding the algorithm By my knowledge,The Sieve of Eratosthenes algorithm is the fastest to find a prime number. The algorithm works on the basis that if a number n is prime, then all multiples of it are no

[Tutor] Help

2010-07-13 Thread Dipo Elegbede
I was trying to write a code that prints prime numbers between 1 and 20. I have by myself seen that something is wrong with my code and also my brain. Could anyone be kind enough to tell me what to do Where I am confused is how to test for other numbers without one and the number itself. It

Re: [Tutor] Request for help learning the right way to deal with listsin lists

2010-07-13 Thread Alan Gauld
"Siren Saren" wrote say I have a list that's a composite of two elements: books and key pages / albums and favorite tracks / medicines and times taken, whatever. Thats a good scenario for using a dictionary containing a list or tuple per key. To make a program that does something to the fir