Пример #1
0
def getWeightedSum(sid):
    sum = 0
    for c in courses:
        smark = []
        warray = []
        for mark in marks:
            if (mark.sid == float(sid)):
                smark.append(mark.getMark())
                warray.append(c.etc)
        weights = numpy.array(warray)
        amark = numpy.array(smark)
        sum = sum + numpy.sum(numpy.dot(amark,weights))
    return sum
Пример #2
0
def getGPA(sid):
    smark = []
    for mark in marks:
        if (str(mark.sid) == str(sid)):
            smark.append(float(mark.getMark()))
    return float(numpy.average(smark))