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

2009-01-03 Thread Kent Johnson
On Sat, Jan 3, 2009 at 9:43 PM, Benjamin Serrato wrote: > I changed it to this: > > #!/usr/local/bin/python3.0 > #problem1.py > > """Lists the sum of all multiples of 3 and 5 less than 1000.""" > > def sumTotal(multipleInitial, multiple):# This awkward solution because >total = 0

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

2009-01-03 Thread Benjamin Serrato
I changed it to this: #!/usr/local/bin/python3.0 #problem1.py """Lists the sum of all multiples of 3 and 5 less than 1000.""" def sumTotal(multipleInitial, multiple):# This awkward solution because total = 0 # mulitipleInitial = multiple just poin

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

2009-01-03 Thread bob gailer
Benjamin Serrato wrote: Hello, I'm trying to correctly solve the first projecteuler.net problem. The question is as so: Find the sum of all the multiples of 3 or 5 below 1000. Also consider that the sum of consecutive integers between 1 and n is n*(n+1)/2. Calculate that for 1..333 then mu

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

2009-01-03 Thread Kent Johnson
On Sat, Jan 3, 2009 at 7:43 PM, Andre Engels wrote: > On Sun, Jan 4, 2009 at 1:06 AM, Benjamin Serrato > wrote: >> Hello, >> >> I'm trying to correctly solve the first projecteuler.net problem. The >> question is as so: Find the sum of all the multiples of 3 or 5 below 1000. > Then the main body

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

2009-01-03 Thread Andre Engels
On Sun, Jan 4, 2009 at 1:06 AM, Benjamin Serrato wrote: > Hello, > > I'm trying to correctly solve the first projecteuler.net problem. The > question is as so: Find the sum of all the multiples of 3 or 5 below 1000. > > I wrote the following program, but the number found is incorrect. I created >

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

2009-01-03 Thread Benjamin Serrato
Hello, I'm trying to correctly solve the first projecteuler.net problem. The question is as so: Find the sum of all the multiples of 3 or 5 below 1000. I wrote the following program, but the number found is incorrect. I created a function that adds multiples of a given number to a global variable

Re: [Tutor] Better way - fnmatch with list ? CORRECTION

2009-01-03 Thread Damon Timm
On Sat, Jan 3, 2009 at 4:35 PM, Mark Tolonen wrote: > fnmatch already takes into account systems with case-sensitive filenames: > help(fnmatch.fnmatch) > > Help on function fnmatch in module fnmatch: > > fnmatch(name, pat) > Test whether FILENAME matches PATTERN. > > Patterns are Unix she

Re: [Tutor] Better way - fnmatch with list ? CORRECTION

2009-01-03 Thread Mark Tolonen
"Damon Timm" wrote in message news:262679b50901031327n23b2f754l62fe0cf98751c...@mail.gmail.com... On Fri, Jan 2, 2009 at 7:16 PM, Jervis Whitley wrote: for fn in files: base, ext = os.path.splitext(fn) if ext.lower() in ['.flac', '.mp3', '.mp4']: takes into account systems with case sen

Re: [Tutor] Better way - fnmatch with list ? CORRECTION

2009-01-03 Thread Damon Timm
On Fri, Jan 2, 2009 at 7:16 PM, Jervis Whitley wrote: > for fn in files: > base, ext = os.path.splitext(fn) > if ext.lower() in ['.flac', '.mp3', '.mp4']: > > takes into account systems with case sensitive filenames. Thanks! Will throw that in there. I'm getting it ... bit by little bit. >

Re: [Tutor] create an empty array of images

2009-01-03 Thread bob gailer
i i wrote: Hi tutor, thanks for the help ,u dont understand cause i have given the psudo code,i have not given the full code only apart of it. I only want an emptty array and put the value [i] in it. This [i] value is the one that i want to show.Im making this activity in glade ,

Re: [Tutor] Help with a simple problem

2009-01-03 Thread bob gailer
Saad Javed wrote: The bold was intentional. I was trying to get a shell command (wvdial) to run when a button is pressed. The error I get is: Traceback (most recent call last): File "testgui.py", line 26, in testgui = TestGui() File "testgui.py", line 19, in __init__ self.connect(d

Re: [Tutor] create an empty array of images

2009-01-03 Thread i i
Hi tutor, thanks for the help ,u dont understand cause i have given the psudo code,i have not given the full code only apart of it. I only want an emptty array and put the value [i] in it. This [i] value is the one that i want to show.Im making this activity in glade ,the set function

Re: [Tutor] Help with a simple problem

2009-01-03 Thread Saad Javed
I implemented a dial function and passed it to the QtCore.SLOT(), which worked fine. Thanks everyone! On Sat, Jan 3, 2009 at 10:33 PM, Kent Johnson wrote: > On Sat, Jan 3, 2009 at 11:39 AM, Saad Javed wrote: > > The bold was intentional. I was trying to get a shell command (wvdial) to > > run w

Re: [Tutor] Help with a simple problem

2009-01-03 Thread Kent Johnson
On Sat, Jan 3, 2009 at 12:28 PM, Alan Gauld wrote: > I think the SIGNAL('clicked()') bit is probably supposed to be: > > SIGNAL('clicked') I think the parens are correct, see http://docs.huihoo.com/pyqt/pyqt4.html#id10 Kent ___ Tutor maillist - Tuto

Re: [Tutor] Help with a simple problem

2009-01-03 Thread Kent Johnson
On Sat, Jan 3, 2009 at 11:39 AM, Saad Javed wrote: > The bold was intentional. I was trying to get a shell command (wvdial) to > run when a button is pressed. The error I get is: > > Traceback (most recent call last): > File "testgui.py", line 26, in > testgui = TestGui() > File "testgui.

Re: [Tutor] Help with a simple problem

2009-01-03 Thread Alan Gauld
"Saad Javed" wrote self.connect(dial, QtCore.SIGNAL('clicked()'), QtGui.qApp, QtCore.SLOT(os.system('wvdial'))) TypeError: argument 1 of SLOT() has an invalid type Was that helpful? Yes, it confirms my earlier email that you should probably quote the argument to SLOT() Alan G. __

Re: [Tutor] Help with a simple problem

2009-01-03 Thread Alan Gauld
"Saad Javed" wrote I'm trying to create a simple GUI using pyqt4 in which pressing a button causes execution of a system command. Here's the code, please help me out. I can't figure out whats wrong. Thanks Caveat: I have never used Qt in my life so this is based on guesswork and experience

Re: [Tutor] Kent's top poster script operator.itemgetter()

2009-01-03 Thread Kent Johnson
On Sat, Jan 3, 2009 at 9:34 AM, Sander Sweers wrote: > On Sat, Jan 3, 2009 at 05:15, Kent Johnson wrote: >> On Fri, Jan 2, 2009 at 6:12 PM, Sander Sweers >> wrote: >>> not understand how operator.itemgetter(1) works. >> >> See >> http://personalpages.tds.net/~kent37/kk/7.html#e7the-operato

Re: [Tutor] Help with a simple problem

2009-01-03 Thread Saad Javed
The bold was intentional. I was trying to get a shell command (wvdial) to run when a button is pressed. The error I get is: Traceback (most recent call last): File "testgui.py", line 26, in testgui = TestGui() File "testgui.py", line 19, in __init__ self.connect(dial, QtCore.SIGNAL('c

Re: [Tutor] Help with a simple problem

2009-01-03 Thread bob gailer
Saad Javed wrote: Hi Tutors, Hi and welcome to the tutor list. We can help you better if you tell us what the problem is. What did you expect? What did you get? Most of us don't have the time or energy to read code when we don't know what we are looking for. Some of your code is bold. Why?

[Tutor] Help with a simple problem

2009-01-03 Thread Saad Javed
Hi Tutors, I'm trying to create a simple GUI using pyqt4 in which pressing a button causes execution of a system command. Here's the code, please help me out. I can't figure out whats wrong. Thanks import sys import os from PyQt4 import QtGui, QtCore class TestGui(QtGui.QWidget): def __init_

Re: [Tutor] create an empty array of images

2009-01-03 Thread bob gailer
i i wrote: yes i want to clear the images before the next iteration,here is the pseudo code what i want to do a = [ ] for i in range(self.numOne) a.append([i]) to create an empty array, and append the index i to the array and pass this index to gtk image,how i can do this in *for-in* stateme

Re: [Tutor] Kent's top poster script operator.itemgetter()

2009-01-03 Thread Sander Sweers
On Sat, Jan 3, 2009 at 05:15, Kent Johnson wrote: > On Fri, Jan 2, 2009 at 6:12 PM, Sander Sweers wrote: >> not understand how operator.itemgetter(1) works. > > See > http://personalpages.tds.net/~kent37/kk/7.html#e7the-operator-module Ok, if I understand this correctly counts.iteritems() c

Re: [Tutor] create an empty array of images

2009-01-03 Thread Kent Johnson
On Sat, Jan 3, 2009 at 3:16 AM, i i wrote: > yes i want to clear the images before the next iteration,here is the pseudo > code what i want to do > > a = [ ] > for i in range(self.numOne) > a.append([i]) > to create an empty array, and append the index i to the array and pass this > index to gtk

[Tutor] create an empty array of images

2009-01-03 Thread i i
yes i want to clear the images before the next iteration,here is the pseudo code what i want to do a = [ ] for i in range(self.numOne) a.append([i]) to create an empty array, and append the index i to the array and pass this index to gtk image,how i can do this in *for-in* statement 0 for i in