EOppi student grading: Difference between revisions

From wikiluntti
Line 6: Line 6:


Save the database as csv file and read it. Choose the exercises and run the python script.
Save the database as csv file and read it. Choose the exercises and run the python script.
<syntaxhighlight lang="python">
#Python3
import csv
import math
import glob
import numpy as np
def getExeNames(titles):
    ti = []
    for title in titles[1:]:
        ti.append(title)
    return ti
def getRow(row):
    r = [row[0]]
    points = []
    for i,p in enumerate( row[1:] ):
        #Convert the numbers separated by space into a array of integers
        #Fetch the max value of and return those.
        #print( p )
        #print( [(i) for i in p.strip().split(' ')] )
        values = [int('0'+i) for i in p.strip().split(' ')]
        #print( values );
        r.append( max( values ))
    return r
<syntaxhighlight>

Revision as of 15:50, 31 January 2021

Introduction

Set the grades according to the points given to the exercises.

Theory

Save the database as csv file and read it. Choose the exercises and run the python script.


<syntaxhighlight lang="python">

  1. Python3

import csv import math import glob import numpy as np

def getExeNames(titles):

   ti = []
   for title in titles[1:]:
       ti.append(title)
   return ti

def getRow(row):

   r = [row[0]]
   points = []
   for i,p in enumerate( row[1:] ):
       #Convert the numbers separated by space into a array of integers
       #Fetch the max value of and return those.
       #print( p )
       #print( [(i) for i in p.strip().split(' ')] )
       values = [int('0'+i) for i in p.strip().split(' ')]
       #print( values );
       r.append( max( values ))
   return r

<syntaxhighlight>