[Tutor] calculate percents of items in a list

2014-08-31 Thread LN A-go-go
What would be a better way to calculate percentages of items in a list? please CountList = [9221382, 10374466, 5192905, 1710238, 3359] CL = [float(i) for i in CountList] CL sum = CL[0] + CL[1] + CL[2] + CL[3] + CL[4] import math perList = [] n = 0 def percentage(CL,sum): for i in CL: P

[Tutor] sorting distances for nearest neighbor

2014-08-29 Thread LN A-go-go
Python Gurus, How do you sort distances to prepare for nearest neighbor when the results returned look like this from the below statements? DR=distance(n,XCOORDINATE, YCOORDINATE, IDCODE) DZ=switch(n,XCOORDINATE, YCOORDINATE, IDCODE) Distance from 1 to 16 is 43763.0757603 19 is 126516.988978 1

[Tutor] import values, calculate distance

2014-08-21 Thread LN A-go-go
Python Mentors, I can't get this code to run and at times, I can't even save it.  It is sections of code used from previous exercises, put it together and it just isn't right.  Thank-you, LN The method is as follows: 1. Run the distance calculations for pt1 to all other points, and pr

Re: [Tutor] (no subject)

2014-07-22 Thread LN A-go-go
.0, 67.0, 72.0, 93.0] >>> sum(flo_list) 2617.0 >>> totalnum = sum(flo_list) >>> len(flo_list) 51 >>> mean = sum(flo_list)/len(flo_list) >>> mean 51.31372549019608 Thank-you again, LN On Monday, July 21, 2014 2:55 AM, Wolfgang Maier wrote: On 21.07.2014

Re: [Tutor] (no subject)

2014-07-21 Thread LN A-go-go
Dear Gurus, Thank-you thank-you, one more time, thank-you. I am over that hurdle and have the other: converting the list of characters that was just created by the split - into integers so I can manipulate them.  I was trying to convert to a string, then to integers.  I have been scouring the we

[Tutor] (no subject)

2014-07-20 Thread LN A-go-go
My apologies Python Gurus for repeating this request for read, write, split and append from a text file in notepad.  I worked on it till late last night and will again today.  I can't seem to get past trying to write the names to one list and the numbers (converted to integers) to the other.  My

[Tutor] Read, Write, Split and Append lines from a text file

2014-07-19 Thread LN A-go-go
I have given it all I got: a week trying to open, read, write, split, append, convert to integers and then manipulate the data.  I have attached the file I want to pull the names and numbers from.  I'll cut and paste it incase that doesn't work and then include a sample of the pytho