Re: [Tutor] SMTP Module Help

2009-01-07 Thread Ole Henning Jensen
Marco Petersen wrote: I'm using Python 2.5.4. I wanted to try out the SMTP module. I tried to send an email through my Gmail account but it keeps saying that the connection was refused. This is the code that I used : import smtplib msg = 'Test' server = smtplib.SMTP('smtp.gmail.com') server

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] what does the "@" operator mean?

2008-12-16 Thread Ole Henning Jensen
Marc Tompkins wrote: By the way, (totally off-topic, of course, my apologies): what do all y'all call the "@" operator? Here in the States, we call it the "at-sign", which I find boring; I believe "sleepycat" is a Scandinavian thing (I picked it up in some long-forgotten article) Continuing of

Re: [Tutor] hypotenuse

2008-03-15 Thread Ole Henning Jensen
bob gailer wrote: > Robert Childers wrote: >> I have rewritten my "hypotenuse" program as follows:>>> #This program >> calculates the width and diagonal of a golden rectangle > print "Calculate the width and diagonal of a golden rectangle." >> Calculate the width and diagonal of a golden recta

Re: [Tutor] Hard time understanding classes

2008-03-12 Thread Ole Henning Jensen
Norm All wrote: > I am learning python and so far have done pretty well, until I got to > the subject of classes which I have been struggling to understand for a > while. I have not found any easy to understand tutorial on the web or > looking in some books for a clear step by step example. Woul

Re: [Tutor] help with slice

2008-03-04 Thread Ole Henning Jensen
> Could someone please explain 'slices' also for dictionaries? > > basically, I'd like to know how you would call every 3rd element in a list > of lists... > > My logic says: ThirdElems=List[:][2] > What this does is, just assign the 3 value of List to the variable. look at this way, step by st

Re: [Tutor] using quotes in IDLE

2007-12-14 Thread Ole Henning Jensen
- Original Message - From: "Jim Morcombe" <[EMAIL PROTECTED]> To: Sent: Friday, December 14, 2007 2:43 AM Subject: [Tutor] using quotes in IDLE A really dumb question... When typing things into IDLE, how are quotes meant to work? If I type" employee.name = "Susan" then IDLE ignores

Re: [Tutor] updating a print statement

2007-12-10 Thread Ole Henning Jensen
Sry about the previous mail. - Original Message - I have a print statement in a for loop so I can watch the progress for line in file(file): the_line = line.split() if the_line: print ("Index = %.2f") %index Is there a way that only one line will be output and the vari

Re: [Tutor] updating a print statement

2007-12-10 Thread Ole Henning Jensen
I have a print statement in a for loop so I can watch the progress for line in file(file): the_line = line.split() if the_line: print ("Index = %.2f") %index Is there a way that only one line will be output and the variable is updated rather than one line for every i