Re: [Tutor] Concerning Programming Exercise #6 of Chapter 2 of Python Programming John Zelle Textbook

2009-01-20 Thread Mark Tolonen
Since you are updating the principal value each year, use the following to grow the principal by the interest rate each year: principal = principal * (1 + apr) -Mark "bob gailer" wrote in message news:49761fdc.5020...@gmail.com... Donna Belle Ibarra wrote: Hi! I need help with program

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread عماد نوفل
On Tue, Jan 20, 2009 at 3:14 PM, Marc Tompkins wrote: > On Tue, Jan 20, 2009 at 11:23 AM, Lie Ryan wrote: > >> what I meant as wrong is that it is possible that the code would be used >> for a string that doesn't represent human language, but arbitrary array >> of bytes. Also, it is a potential s

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Marc Tompkins
On Tue, Jan 20, 2009 at 11:23 AM, Lie Ryan wrote: > what I meant as wrong is that it is possible that the code would be used > for a string that doesn't represent human language, but arbitrary array > of bytes. Also, it is a potential security issue. This is something I need to know, then - sys

Re: [Tutor] lists

2009-01-20 Thread David
Norman Khine wrote: > Hi, > actually what I was trying to do carries from my last post, where my > media files are a list that I want to add to the > > subprocess.call(['sox', ', '.join(media_list), 'list.wav']) Something like this may work; #!/usr/bin/python import subprocess def play(filename):

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Lie Ryan
On Tue, 20 Jan 2009 09:20:22 -0800, Marc Tompkins wrote: > On Tue, Jan 20, 2009 at 5:42 AM, Lie Ryan wrote: > >> > Using sys.maxint to prime minLen is overkill, of course - >> > "antidisestablishmentarianism" is only 28 letters long, after all - >> > but it should be larger than any word you can

Re: [Tutor] Concerning Programming Exercise #6 of Chapter 2 of Python Programming John Zelle Textbook

2009-01-20 Thread bob gailer
Donna Belle Ibarra wrote: Hi! I need help with program exericse #6 entitled "Futval.py" which is a program that computes the value of an investment carried 10 years into the future. This is the coding I have.. yet it does not seem to spit out the correct numbers (Am I using an incorrect equa

Re: [Tutor] lists

2009-01-20 Thread Kent Johnson
On Tue, Jan 20, 2009 at 1:02 PM, Norman Khine wrote: > Hi, > actually what I was trying to do carries from my last post, where my media > files are a list that I want to add to the > > subprocess.call(['sox', ', '.join(media_list), 'list.wav']) OK, you want a list, not a string. You can use + to

[Tutor] Concerning Programming Exercise #6 of Chapter 2 of Python Programming John Zelle Textbook

2009-01-20 Thread Donna Belle Ibarra
Hi! I need help with program exericse #6 entitled "Futval.py" which is a program that computes the value of an investment carried 10 years into the future. This is the coding I have.. yet it does not seem to spit out the correct numbers (Am I using an incorrect equation?) *def main(): print "

Re: [Tutor] lists

2009-01-20 Thread Norman Khine
Hi, actually what I was trying to do carries from my last post, where my media files are a list that I want to add to the subprocess.call(['sox', ', '.join(media_list), 'list.wav']) >>> print ', '.join(media_list) upper_b.wav, upper_a.wav >>> subprocess.call(['sox', ', '.join(media_list), 'lis

Re: [Tutor] lists

2009-01-20 Thread Arun Tomar
hi! On Tue, Jan 20, 2009 at 10:30 PM, Kent Johnson wrote: > On Tue, Jan 20, 2009 at 11:30 AM, Norman Khine wrote: >> Hi >> What am I doing wrong >> > media_list = ['upper_b.wav', 'upper_a.wav'] > print '%s' % (for x in media_list) >> File "", line 1 >>print '%s' % (for x in media_li

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Marc Tompkins
On Tue, Jan 20, 2009 at 5:42 AM, Lie Ryan wrote: > > Using sys.maxint to prime minLen is overkill, of course - > > "antidisestablishmentarianism" is only 28 letters long, after all - but > > it should be larger than any word you can expect to see. This doesn't > > catch ties, though... could do t

Re: [Tutor] lists

2009-01-20 Thread Kent Johnson
On Tue, Jan 20, 2009 at 11:30 AM, Norman Khine wrote: > Hi > What am I doing wrong > media_list = ['upper_b.wav', 'upper_a.wav'] print '%s' % (for x in media_list) > File "", line 1 >print '%s' % (for x in media_list) >^ > SyntaxError: invalid syntax print '

[Tutor] lists

2009-01-20 Thread Norman Khine
Hi What am I doing wrong >>> media_list = ['upper_b.wav', 'upper_a.wav'] >>> print '%s' % (for x in media_list) File "", line 1 print '%s' % (for x in media_list) ^ SyntaxError: invalid syntax >>> print '%s' % (x for x in media_list) I want to replace %s with the items

Re: [Tutor] Question about pygame/tkinter interaction

2009-01-20 Thread Lie Ryan
On Tue, 2009-01-20 at 08:04 -0800, Steve Willoughby wrote: > > In this case, that might be enough. I just need to show a video clip > in > an otherwise fairly simple GUI. A decorationless, borderless window > popped up on the screen over the Tk stuff would probably work. Thanks > for the advice

Re: [Tutor] MySqldb problem

2009-01-20 Thread David
Manoj kumar wrote: > > > hi all, > > i am a newbie to python programming. i just know basics of the > language. i came across MySqldb. i able to manipulate database with > MySqldb but i wasn't able to add files in database through the lib > MySqldb. > > any help will be welcomed grace

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread عماد نوفل
On Tue, Jan 20, 2009 at 10:33 AM, Paul McGuire wrote: > "Finding the shortest word among a list of words" sounds like something of > a > trick question to me. I think a more complete problem statement would be > "Find the list of words that are the shortest", since there is no guarantee > that t

Re: [Tutor] Ip address

2009-01-20 Thread Irimia, Suleapa
wormwood_3 wrote: Hello, This is definitely possible. It's more a matter of system and OS configuration than Python though, so you might want to check out some Linux forums ( http://www.linuxforums.org/ ) for additional help. In short, I think the simplest would be: Have 3 separate network in

[Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Paul McGuire
"Finding the shortest word among a list of words" sounds like something of a trick question to me. I think a more complete problem statement would be "Find the list of words that are the shortest", since there is no guarantee that the list does not contain two words of the same shortest length. I

Re: [Tutor] Ip address

2009-01-20 Thread Lie Ryan
On Mon, 19 Jan 2009 19:47:54 -0800, wormwood_3 wrote: > Hello, > > This is definitely possible. It's more a matter of system and OS > configuration than Python though, so you might want to check out some > Linux forums ( http://www.linuxforums.org/ ) for additional help. In > short, I think the s

Re: [Tutor] creating a sound file from a string

2009-01-20 Thread Kent Johnson
On Tue, Jan 20, 2009 at 9:00 AM, Norman Khine wrote: >> from os import popen >> merge = popen('sox uppercase-b.wav uppercase-a.wav merge.wav') >> >> I'm not sure but you may have to read from merge to allow the process >> to complete. You might want to use os.system() or one of the >> sub

Re: [Tutor] creating a sound file from a string

2009-01-20 Thread Norman Khine
Thanks, Kent Johnson wrote: On Tue, Jan 20, 2009 at 8:12 AM, Norman Khine wrote: Is this a safe way to generate random sound files on a web server? from os import popen merge = popen('sox uppercase-b.wav uppercase-a.wav merge.wav') I'm not sure but you may have to read from merge to allow

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Lie Ryan
On Mon, 19 Jan 2009 19:13:32 -0800, Marc Tompkins wrote: > 2009/1/19 John Fouhy > >> 2009/1/20 Emad Nawfal (عماد نوفل) : Of course, >> this is not necessarily the best answer for your particular problem. >> The problem with sorting is that you have to look at some elements more >> than once. F

Re: [Tutor] creating a sound file from a string

2009-01-20 Thread Kent Johnson
On Tue, Jan 20, 2009 at 8:12 AM, Norman Khine wrote: > Is this a safe way to generate random sound files on a web server? > from os import popen merge = popen('sox uppercase-b.wav uppercase-a.wav merge.wav') I'm not sure but you may have to read from merge to allow the process to comple

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Kent Johnson
On Tue, Jan 20, 2009 at 7:13 AM, Emad Nawfal (عماد نوفل) wrote: > 2009/1/20 Kent Johnson >> decorate-sort-undecorate is pretty much obsolete since the key= >> parameter was added to sort() in Python 2.4. > When you say that something is obsolete, what does this mean? Is that just > because there

Re: [Tutor] creating a sound file from a string

2009-01-20 Thread Norman Khine
Is this a safe way to generate random sound files on a web server? >>> from os import popen >>> merge = popen('sox uppercase-b.wav uppercase-a.wav merge.wav') Thanks Norman Kent Johnson wrote: On Tue, Jan 20, 2009 at 4:49 AM, Norman Khine wrote: does anyone know of a python module which wo

Re: [Tutor] MySqldb problem

2009-01-20 Thread Chris Babcock
On 20 Jan 2009 11:10:14 - "Manoj kumar" wrote: > i am a newbie to python programming. i just know basics of the > language. i came across MySqldb. i able to manipulate database with > MySqldb but i wasn't able to add files in database through the lib > MySqldb. Right. Whatever you wa

Re: [Tutor] creating a sound file from a string

2009-01-20 Thread Norman Khine
Thanks I am looking at this now. From unix I could run sox so that $ sox uppercase-a.wav uppercase-b.wav ab.wav this produces a merged uppercase-a.wav uppercase-b.wav perhaps this is a better way, but requires having to execute an external programme. any thoughts? cheers norman Kent John

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread عماد نوفل
2009/1/20 Kent Johnson > On Mon, Jan 19, 2009 at 9:47 PM, Emad Nawfal (عماد نوفل) > wrote: > > > Thanks John for this. Although the decorate-sort-undecorate idiom looks > so > > natural to me now, I don't think I would have found it on my own. I have > > that deja vu effect towards it. > > decor

Re: [Tutor] creating a sound file from a string

2009-01-20 Thread Kent Johnson
On Tue, Jan 20, 2009 at 4:49 AM, Norman Khine wrote: > does anyone know of a python module which would create a single sound file > based on the randomly generated string? > > i have looked at the python wave module, but if i am not wrong this works > with one file at the time. I think you can do

Re: [Tutor] Question about pygame/tkinter interaction

2009-01-20 Thread Lie Ryan
On Mon, 19 Jan 2009 15:46:27 -0800, Steve Willoughby wrote: > On Mon, Jan 19, 2009 at 05:30:01PM -0500, Kent Johnson wrote: >> My guess is that pygame and Tkinter are both going to want to control >> the event loop. Googling 'pygame tkinter' gives both hints that it >> might be possible and hints

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Kent Johnson
On Mon, Jan 19, 2009 at 9:47 PM, Emad Nawfal (عماد نوفل) wrote: > Thanks John for this. Although the decorate-sort-undecorate idiom looks so > natural to me now, I don't think I would have found it on my own. I have > that deja vu effect towards it. decorate-sort-undecorate is pretty much obsole

[Tutor] MySqldb problem

2009-01-20 Thread Manoj kumar
  hi all, i am a newbie to python programming. i just know basics of the language. i came across MySqldb. i able to manipulate database with MySqldb but i wasn't able to add files in database through the lib MySqldb. any help will be welcomed gracefully. thanks. M

[Tutor] creating a sound file from a string

2009-01-20 Thread Norman Khine
hello, i have a string that is generated that contains letters and numbers. i also have a folder which contains the following: sounds/ upper-a.wav upper-b.wav .. lower-a.wav lower-b.wav ... sign-£.wav sign-|.wav .. number-0.wav number-1.wav .. does anyone know of a python module which would cre