Created
May 8, 2012 09:01
-
-
Save daonb/2633730 to your computer and use it in GitHub Desktop.
summary of donations raised
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| sum_nis = 0; num_nis = 0 | |
| sum_usd = 0; num_usd = 0 | |
| for i in csv.reader(open("donations.csv")): | |
| if i[2]: | |
| sum_usd+=float(i[2][:-4].replace(",","")) | |
| num_usd+=1 | |
| else: | |
| sum_nis+=int(i[1]) | |
| num_nis+=1 | |
| print "USD donation: total %s average %s" % (sum_usd,sum_usd/num_usd) | |
| print "NIS donation: total %s average %s" % (sum_nis,sum_nis/num_nis) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment