Re: [Tutor] python lists/nested lists

2013-04-13 Thread Steven D'Aprano
On 14/04/13 06:53, Soliman, Yasmin wrote: How can I calculate the average of a list of numbers (eg [2,5,8,7,3] ) and then subtract the avg from the original numbers in the list and print? You calculate the average by summing the list, then dividing by the number of items. To sum a list of n

Re: [Tutor] python lists/nested lists

2013-04-13 Thread Alan Gauld
On 13/04/13 21:53, Soliman, Yasmin wrote: How can I calculate the average of a list of numbers (eg [2,5,8,7,3] ) > and then subtract the avg from the original numbers > in the list and print? This sounds like homework which we don;t do for you. However to calculate the average take the sum and

Re: [Tutor] python lists/nested lists

2013-04-13 Thread Mark Lawrence
On 13/04/2013 21:53, Soliman, Yasmin wrote: How can I calculate the average of a list of numbers (eg [2,5,8,7,3] ) and then subtract the avg from the original numbers in the list and print? lst = [2,5,8,7,3] avg = sum(lst) / len(lst) print(avg) for n in lst: print(n - avg) Also, if I ha

[Tutor] python lists/nested lists

2013-04-13 Thread Soliman, Yasmin
How can I calculate the average of a list of numbers (eg [2,5,8,7,3] ) and then subtract the avg from the original numbers in the list and print? Also, if I have a nested list: sick_patients=[['Sam', 'M', 65, 'chest pain', 101.6], [['Sarah', 'F', 73, 'dizziness', 98.6], [['Susie', 'F', 34, 'he

Re: [Tutor] Python Lists--A Suggestion

2009-04-08 Thread Wayne Watson
Title: Signature.html Tried it. No doubt there are many. Kent Johnson wrote: On Wed, Apr 8, 2009 at 4:27 PM, Wayne Watson wrote: Sounds fine to me. Is that actually a real link though? If so, who posts there. If not, I'd suggest, www.pytutor-sendspace.com. Yes it is r

Re: [Tutor] Python Lists--A Suggestion

2009-04-08 Thread Wayne Watson
Title: Signature.html In my case, it certainly does. In fact, my posts are refused for other python related NGs. :-) From what I can tell via googling, it's not just me. Emile van Sebille wrote: Wayne Watson wrote: Perhaps the Pyton organization could produce their mail lists, if they ha

Re: [Tutor] Python Lists--A Suggestion

2009-04-08 Thread Kent Johnson
On Wed, Apr 8, 2009 at 4:27 PM, Wayne Watson wrote: > Sounds fine to me. Is that actually a real link though? If so, who posts > there. If not, I'd suggest, www.pytutor-sendspace.com. Yes it is real, try it! It's open to the public so anyone can post. Kent > Kent Johnson wrote: > > On Tue, Apr

Re: [Tutor] Python Lists--A Suggestion

2009-04-08 Thread Emile van Sebille
Wayne Watson wrote: Perhaps the Pyton organization could produce their mail lists, if they have any control over them. Maybe that's the source of the inconsistency? Has anyone pointed out that posting through gmane eliminates the inconsistency? Emile __

Re: [Tutor] Python Lists--A Suggestion

2009-04-08 Thread Wayne Watson
Title: Signature.html Sounds fine to me. Is that actually a real link though? If so, who posts there. If not, I'd suggest, www.pytutor-sendspace.com. Kent Johnson wrote: On Tue, Apr 7, 2009 at 11:55 PM, Wayne Watson wrote: My suggestion is aimed at those who want to use graphic

Re: [Tutor] Python Lists--A Suggestion

2009-04-08 Thread Kent Johnson
On Tue, Apr 7, 2009 at 11:55 PM, Wayne Watson wrote: > My suggestion is aimed at those who want to use graphic > material to support their questions or problems. Make a postable web site > called something like www.python-tutor-pix-post.net, where one could easily > put something there for 30 days

Re: [Tutor] Python Lists--A Suggestion

2009-04-07 Thread Wayne Watson
Title: Signature.html Produce in the sense of movie producers. In any case, I mean own, host, create and control. Yes, if it's uncontrolled, then it would be difficult to find continuity. My suggestion is aimed at those who want to use graphic material to support their questions or problems. Ma

Re: [Tutor] Python Lists--A Suggestion

2009-04-07 Thread Kent Johnson
On Tue, Apr 7, 2009 at 9:13 PM, Wayne Watson wrote: > Perhaps the Pyton organization could produce their mail lists, if they have > any control over them. Maybe that's the source of the inconsistency? That > is, some are not sponsored by them. I don't really know what you mean by "produce" their

Re: [Tutor] Python Lists--A Suggestion

2009-04-07 Thread Wayne Watson
Title: Signature.html Perhaps the Pyton organization could produce their mail lists, if they have any control over them. Maybe that's the source of the inconsistency? That is, some are not sponsored by them. Alan Gauld wrote: "Wayne Watson" wrote  I offered in that thread that it mig

Re: [Tutor] Python Lists--A Suggestion

2009-04-07 Thread Alan Gauld
"Wayne Watson" wrote I offered in that thread that it might be useful to allow people to post images and videos. They can sometimes be very useful One response was that such sites are generally available. Indeed and posting big images or any size video in a mailing list would be very

[Tutor] Python Lists--A Suggestion

2009-04-07 Thread Wayne Watson
Title: Signature.html In mulling over some comments in the thread "Please use plain text", I have a suggestion. I offered in that thread that it might be useful to allow people to post images and videos. They can sometimes be very useful for understanding what's going on with a problem. I've ce

Re: [Tutor] Python Lists

2005-07-17 Thread DaSmith
Thank you Danny, you guessed correctly, problem solved ! Kind Regards, Daniel Smith  -Danny Yoo <[EMAIL PROTECTED]> wrote: -To: [EMAIL PROTECTED]From: Danny Yoo <[EMAIL PROTECTED]>Date: 07/15/2005 10:06PMcc: tutor@python.orgSubject: Re: [Tutor] Python Lists> I have create

Re: [Tutor] Python Lists

2005-07-15 Thread Hugo González Monteverde
Looks like you may be using default values in the constructor. The object is created with, say, an empty list as a default argument, but this argument is defined only one, when the function is defined. look: >>> def myfunc(mylist = []): mylist.append(1) print mylist >>> myfunc() [

Re: [Tutor] Python Lists

2005-07-15 Thread Danny Yoo
> I have created a class which has many "Nested list" attributes. When I > create a second instance of the class, the lists are not empty, and > already contain the same values as were held in the previous > instantiation. As a C/C++ programmer, this majes no semns to me at all. > Could someone p

Re: [Tutor] Python Lists

2005-07-15 Thread Jonathan Conrad
All of the objects in Python are passed by reference: the address and the type of the object. The immutable types, such as our old friend the int, are shared by the function and the application, as well. Assigning to the function variable containing the int cannot change the int itself, only

[Tutor] Python Lists

2005-07-15 Thread DaSmith
Hi, I am a new Python Programmer, and am encountering some problems with lists. I have created a class which has many "Nested list" attributes. When I create a second instance of the class, the lists are not empty, and already contain the same values as were held in the previous instantiation.

Re: [Tutor] python lists to C arrays and vice versa

2005-02-07 Thread Danny Yoo
On Mon, 7 Feb 2005, Viktor Hornak wrote: > I've been trying to find more resources/documentation about how to > convert python lists to C arrays (and vice versa) when writing a python > extension. Hi Viktor, There was a post back in 1999 that might be useful for you: http://mail.python.o

[Tutor] python lists to C arrays and vice versa

2005-02-07 Thread Viktor Hornak
Hello All, I've been trying to find more resources/documentation about how to convert python lists to C arrays (and vice versa) when writing a python extension. Surprisingly, there's very little one can find about this even though it must be a fairly common procedure. I looked through official