[Tutor] extreme basics

2009-01-04 Thread Mr Gerard Kelly
This is extremely weird, I think. Here is a tiny program: from math import * from Numeric import * x=[0]*10 for counter in rangelen((x)): x[counter]=counter*0.1 print x Here is what I get: [0.0, 0.10001, 0.20001, 0.30004, 0.40002, 0.5, 0

Re: [Tutor] Python - Data Mining?

2009-01-04 Thread ALAN GAULD
> Can Python be used to mine an Openoffice spreadsheet > or database? There are Python - OO links. I've never used them but a Google search will throw them up I'm sure. But the easiest way is probably either to export the data as a CSV file and use the csv module or to put the data in a databa

Re: [Tutor] Python - Data Mining?

2009-01-04 Thread Nick Scholtes
Thanks, Alan. Good to know. I think I'll explore both routes, as it will at least get me some practice with Python. Oh, wait. Can Python be used to mine an Openoffice spreadsheet or database? Nick On Sun, Jan 4, 2009 at 3:45 PM, Alan Gauld wrote: > > "Nick Scholtes" wrote > > mind. For inst

Re: [Tutor] Python - Data Mining?

2009-01-04 Thread Nick Scholtes
Thanks, Alan. Good to know. I think I'll explore both routes, as it will at least get me some practice with Python. Nick On Sun, Jan 4, 2009 at 3:45 PM, Alan Gauld wrote: > > "Nick Scholtes" wrote > > mind. For instance, I work with some groups that rescue homeless animals. >> It >> would b

Re: [Tutor] RE Silliness

2009-01-04 Thread spir
On Sun, 04 Jan 2009 14:09:53 -0500 bob gailer wrote: > Omer wrote: > > I'm sorry, burrowed into the reference until my eyes bled. > > > > What I want is to have a regular expression with an optional ending of > > "" > > > > (For those interested, > > urlMask = r"http://[\w\Q./\?=\R]+"; > > is th

Re: [Tutor] Documentation and top matter

2009-01-04 Thread Alan Gauld
"wormwood_3" wrote #!/usr/bin/env python #- """ My awesome purpose. """ author = "My Name" date_started = "2001-01-01" version = 0.1 #- IMPORT

Re: [Tutor] Python - Data Mining?

2009-01-04 Thread Alan Gauld
"Nick Scholtes" wrote mind. For instance, I work with some groups that rescue homeless animals. It would be wonderful if I could compile a thorough database, then mine the data and create graphs to troubleshoot issues. As an example, we might find that more homeless animals show up in "x" lo

Re: [Tutor] WinMerge -- I'm Impressed

2009-01-04 Thread Alan Gauld
"Wayne Watson" wrote It took me 15 minutes to merge the two in an acceptable manner. I just tried the result and am happy to report that it works as expected. Glad to hear it, there are many such merge tools around some more automated than others. Doing this by inspection of printed lists

Re: [Tutor] Top posters to tutor list for 2008

2009-01-04 Thread W W
I think I find it most interesting that the greatest percent is still under 15% and then it tapers rapidly. I'm curious what % of people posted 5 or less messages... perhaps it will become a personal project somewhere down the road ;) -Wayne On Fri, Jan 2, 2009 at 7:28 AM, Kent Johnson wrote: >

Re: [Tutor] Python - Data Mining?

2009-01-04 Thread Nick Scholtes
Thank you all so much for the great information so far. I really appreciate it. I'm going over it now. And sample code helps TON! That really allows me to see what happens with a program. In reference to wormwood_3's question about my intentions for data mining; I want to know this stuff in genera

[Tutor] Documentation and top matter

2009-01-04 Thread wormwood_3
While PEP 8 and PEP 257 provide ample helpful information on the recommended ways to document classes, functions, and comments within code, I am having a hard time finding recommendations on how to document scripts by way of top matter. For example, I used this format for a while: #!/usr/bin/en

Re: [Tutor] Python - Data Mining?

2009-01-04 Thread Kent Johnson
On Sun, Jan 4, 2009 at 1:25 PM, Nick Scholtes wrote: > Hi, > I'm still very, very new to Python and programming. I was wondering if > anyone can point me in the right direction. Welcome! > As I gradually learn Python, one of the things I want to be able to do is > take a database, run queries an

Re: [Tutor] Python - Data Mining?

2009-01-04 Thread wormwood_3
I have done some data analysis work with Python, mostly with MySQL databases. Just as easy as the examples Eric mentioned with SQLite. All depends on what database you have to work with. Did you have any in mind or just wondering about data mining and Python in general? Regarding graphing, I ha

Re: [Tutor] Python - Data Mining?

2009-01-04 Thread Eric Dorsey
Hi Nick, I don't know about the graphing portion of your question, but yes Python does interact very well with databases. I have been working on a workout tracking program the last two months or so, and I'm new to programming. I'd highly recommend SQLite as a built-in database solution. I know it's

Re: [Tutor] Tutor Digest, Vol 59, Issue 16

2009-01-04 Thread Emmanuel Ruellan
Gerard Kelly wrote: > Hi everyone, I'm a python noob but I have an ambitious (for me) goal: I > want to make a simple program that allows you to hear combinations of > notes according to a vector of frequencies. > > Does anybody know any module that allows you to input a frequency in Hz > and retur

Re: [Tutor] RE Silliness

2009-01-04 Thread bob gailer
Omer wrote: I'm sorry, burrowed into the reference until my eyes bled. What I want is to have a regular expression with an optional ending of "" (For those interested, urlMask = r"http://[\w\Q./\?=\R]+"; is ther version w/o the optional ending.) I can't seem to make a string optional- only

[Tutor] WinMerge -- I'm Impressed

2009-01-04 Thread Wayne Watson
Title: Signature.html Several months ago I took a Python (2.4) program (A) distributed by our sponsors and made a number of mods. About 4 months later the sponsors updated it (B) to operate under 2.5 and added a number of changes of their own. I dreaded the thought of merging A into B, so have

Re: [Tutor] Add all natural numbers that are multiples of 3 and 5

2009-01-04 Thread bob gailer
Alan Gauld wrote: "bob gailer" wrote Also consider that the sum of consecutive integers between 1 and n is n*(n+1)/2. Calculate that for 1..333 then multiply by 3 Calculate that for 1..199 then multiply by 5 add those Calculate that for 1..66 then multiply by 15 subtract that from the total

[Tutor] Python - Data Mining?

2009-01-04 Thread Nick Scholtes
Hi, I'm still very, very new to Python and programming. I was wondering if anyone can point me in the right direction. As I gradually learn Python, one of the things I want to be able to do is take a database, run queries and extract information and then graph that information visually to see patt

[Tutor] RE Silliness

2009-01-04 Thread Omer
I'm sorry, burrowed into the reference until my eyes bled. What I want is to have a regular expression with an optional ending of "" (For those interested, urlMask = r"http://[\w\Q./\?=\R]+"; is ther version w/o the optional ending.) I can't seem to make a string optional- only a single charact

Re: [Tutor] Add all natural numbers that are multiples of 3 and 5

2009-01-04 Thread Alan Gauld
"bob gailer" wrote Also consider that the sum of consecutive integers between 1 and n is n*(n+1)/2. Calculate that for 1..333 then multiply by 3 Calculate that for 1..199 then multiply by 5 add those Calculate that for 1..66 then multiply by 15 subtract that from the total Ooh, that's sneaky

Re: [Tutor] repply

2009-01-04 Thread Ole Henning Jensen
prasad rao wrote: hi I got it right. >>> z=[] >>> for x in range(1000): if divmod(x,3)[1]==0:z.append(x) if divmod(x,5)[1]==0:z.append(x) >>> sum(set(z)) 233168 Instead of using the set function you could just use an elif in your for loop. >>> z=[] >>> for x in range(1000):

Re: [Tutor] Sound, frequencies and chords

2009-01-04 Thread Kent Johnson
On Sun, Jan 4, 2009 at 8:07 AM, Mr Gerard Kelly wrote: > Hi everyone, I'm a python noob but I have an ambitious (for me) goal: I > want to make a simple program that allows you to hear combinations of > notes according to a vector of frequencies. > > Does anybody know any module that allows you to

Re: [Tutor] repply

2009-01-04 Thread Sander Sweers
On Sun, Jan 4, 2009 at 14:18, prasad rao wrote: z=[] for x in range(1000): > if divmod(x,3)[1]==0:z.append(x) > if divmod(x,5)[1]==0:z.append(x) sum(set(z)) > 233168 This can be done in one line of python. >>> sum([x for x in range(1000) if x %3 == 0 or x % 5 == 0]) 233168 Greets

[Tutor] repply

2009-01-04 Thread prasad rao
hi I got it right. >>> z=[] >>> for x in range(1000): if divmod(x,3)[1]==0:z.append(x) if divmod(x,5)[1]==0:z.append(x) >>> sum(set(z)) 233168 I am sorry if this is outside the perimeter of this list. ___ Tutor maillist - Tutor@python.org http://

[Tutor] Sound, frequencies and chords

2009-01-04 Thread Mr Gerard Kelly
Hi everyone, I'm a python noob but I have an ambitious (for me) goal: I want to make a simple program that allows you to hear combinations of notes according to a vector of frequencies. Does anybody know any module that allows you to input a frequency in Hz and returns a sound with that frequency

Re: [Tutor] project euler

2009-01-04 Thread Roel Schroeven
prasad rao schreef: > hello! > I got it 266333. > My code== > > t=0 > for x in range(1000): > if divmod(x,3)[1]==0:t+=x > if divmod(x,5)[1]==0:t+=x > t=266333 > > Am I correct in comprehention of the problem? Not entirely: you're counting numbers that are multiples of both 3 and 5 double

[Tutor] project euler

2009-01-04 Thread prasad rao
hello! I got it 266333. My code== t=0 for x in range(1000): if divmod(x,3)[1]==0:t+=x if divmod(x,5)[1]==0:t+=x t=266333 Am I correct in comprehention of the problem? Prasad ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/

Re: [Tutor] Add all natural numbers that are multiples of 3 and 5

2009-01-04 Thread Andre Engels
On Sun, Jan 4, 2009 at 3:43 AM, Benjamin Serrato wrote: > I think it does what I wanted it to do, but Kent pointed out I wanted > it to do was a false solution. So, I can create a list of all common > multiples below 1000, sum them, subtract them from 266 333. Or, what > I prefer, create a list