Re: [Tutor] global list

2014-04-23 Thread Steven D'Aprano
On Wed, Apr 23, 2014 at 04:46:49PM -0700, Denis Heidtmann wrote: > In a coursera python course video the following code was presented: > > a = [4,5,6] > > def mutate_part(x): > a[1] = x > > mutate_part(200) > > The presenter said something like "a is a global variable, so a becomes > > [4,

Re: [Tutor] methods of sorting

2014-04-23 Thread Patti Scott
This makes sense.  Thanks.  No question on the specific code, I was just thinking I should show I'd done any experimenting with the methods Hi Patti, My answers below, interleaved between your questions. On Tue, Apr 22, 2014 at 04:18:38PM -0700, Patti Scott wrote: > I'm practicing with li

[Tutor] global list

2014-04-23 Thread Denis Heidtmann
In a coursera python course video the following code was presented: a = [4,5,6] def mutate_part(x): a[1] = x mutate_part(200) The presenter said something like "a is a global variable, so a becomes [4,200,6] after running mutate_part(200)." Indeed it does, but why does this work without s

Re: [Tutor] Fwd: Puzzle - Next Step to our interviewing process - Pramati Technologies!

2014-04-23 Thread Danny Yoo
Hi Brian, No problem. Just be more careful next time. In particular, look at the context. The homework question I'm posing to Sunil is fairly basic, intentionally so, but is designed so that if he solves it with basic, standard tools (fresh list construction, list iteration, list appending), he

Re: [Tutor] Fwd: Puzzle - Next Step to our interviewing process - Pramati Technologies!

2014-04-23 Thread brian arb
My Bad On Wed, Apr 23, 2014 at 1:53 PM, Danny Yoo wrote: > Hi Brian, > > I would suggest not providing homework solutions. > > Look at the beginning of this thread to see why just giving homework > solutions is not helpful for the questioner. > ___ Tu

Re: [Tutor] Fwd: Puzzle - Next Step to our interviewing process - Pramati Technologies!

2014-04-23 Thread Danny Yoo
Hi Brian, I would suggest not providing homework solutions. Look at the beginning of this thread to see why just giving homework solutions is not helpful for the questioner. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription o

Re: [Tutor] Fwd: Puzzle - Next Step to our interviewing process - Pramati Technologies!

2014-04-23 Thread brian arb
>>> nums1 = [3, 1, 4] >>> nums2 = [2, 7, 1] >>> [ sum(i) for i in zip(nums1, nums2)] [5, 8, 5] On Wed, Apr 23, 2014 at 1:12 PM, Danny Yoo wrote: > Hi Sunil, > > > Try a simpler but related problem first. > > Say that you have two lists of numbers, like: > > ## > nums1 = [3, 1, 4] > nums2

Re: [Tutor] Fwd: Puzzle - Next Step to our interviewing process - Pramati Technologies!

2014-04-23 Thread Danny Yoo
Hi Sunil, Try a simpler but related problem first. Say that you have two lists of numbers, like: ## nums1 = [3, 1, 4] nums2 = [2, 7, 1] ## Can you design a function addLists() that takes two lists of numbers of equal length, and adds them together? For example, addLists(nums1, nu

Re: [Tutor] inheritance and super() function in python

2014-04-23 Thread Mark Lawrence
On 23/04/2014 14:56, Jorge Leon wrote: class Cylinder(Obstacle): def __init__(self,position, height, radius): super(Obstacle,self).__init__(position) But it looks to me like the last line should be super(Cylinder, self).__init__(position) Hey, thanks again for the help

Re: [Tutor] Fwd: Puzzle - Next Step to our interviewing process - Pramati Technologies!

2014-04-23 Thread Sunil Tech
i have {'extreme_fajita': [*{5: 4.0}*, *{6: 6.0}*], 'fancy_european_water': [*{5: 8.0}*, *{6: 5.0}*]} if the keys of the dictionaries(bold & italic) are equal. I want to add bold dict values, & italic dict values. result should some thing like this [{5:12.0},{6:11.5}] i tried to do... but ne

Re: [Tutor] inheritance and super() function in python

2014-04-23 Thread Jorge Leon
> class Cylinder(Obstacle): >def __init__(self,position, height, radius): >super(Obstacle,self).__init__(position) > > But it looks to me like the last line should be > super(Cylinder, self).__init__(position) > Hey, thanks again for the help and sorry about all the format err

Re: [Tutor] SMTPLIB Exception Object

2014-04-23 Thread Alan Gauld
On 23/04/14 04:35, Hobie Audet wrote: documentation has me confused. Specifically, the documentation on the SMTPRecipientsRefused exception says: All recipient addresses refused. The errors for each recipient are accessible through the attribute recipients,... But where is the "recipi

Re: [Tutor] SMTPLIB Exception Object

2014-04-23 Thread Dave Angel
Hobie Audet Wrote in message: > It would be much better if you used text emails to post on this text list, rather than html. For one thing, your indentation might not be messed up. For another, I might be able to do proper quoting. > (you wrote): My code looks something like this:    

[Tutor] SMTPLIB Exception Object

2014-04-23 Thread Hobie Audet
I am using Python 3.3 and smtplib to generate and send some E-mail. I am trying to figure out how to handle some exceptions, but some of the documentation has me confused. Specifically, the documentation on the SMTPRecipientsRefused exception says: exception smtplib.SMTPRecipientsRefused Al