Skip to content

Instantly share code, notes, and snippets.

@takuma7
Created March 17, 2014 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takuma7/9601156 to your computer and use it in GitHub Desktop.
Save takuma7/9601156 to your computer and use it in GitHub Desktop.
# coding: utf8
import a2
import csv
reader = csv.DictReader(open("evaluation-values.csv"))
leapAvg = 0
leapNum = 0
nonLeapAvg = 0
nonLeapNum = 0
for row in reader:
if(a2.isLeapYear(int(row["誕生年"]))):
leapAvg += int(row["評価点 (100点満点)"])
leapNum += 1.0
else:
nonLeapAvg += int(row["評価点 (100点満点)"])
nonLeapNum += 1.0
leapAvg /= leapNum
nonLeapAvg /= nonLeapNum
print "閏年生まれの人の平均評価点:\t{0}\n閏年生まれでない人の平均評価点:\t{1}".format(leapAvg, nonLeapAvg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment