赞
踩
干得好:
class Student(object):
def __init__(self, name):
self.name = name
self.scores = []
self.highestscore = 0
def __repr__(self):
return '<' + self.name + ', ' \
+ 'high=' + str(self.highestscore) + ', ' \
+ 'avg=' + str(self.getAverage()) + '>'
def addScore(self, score):
self.scores.append(score)
self.highestscore = max(self.highestscore, score)
def getAverage(self):
l = len(self.scores)
if l == 0:
return 0
else:
return sum(self.scores) / l
import csv
results = open("C:\Projetos\Data\Python\Scores1.csv", "r+")
csv1 = csv.reader(results, delimiter=",")
data = {}
highscore = 0
for eachline in csv1:
#print(eachline
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。