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:
PER = "return 100 * float (CL[0])/float (sum)"
perList.append(PER)
n = n + 1
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor