|
|
(3 intermediate revisions by the same user not shown) |
Line 10: |
Line 10: |
|
| |
|
| https://gist.github.com/markkuleino/bea1d81b41b233a8a3dbb2b6659a2222 | | https://gist.github.com/markkuleino/bea1d81b41b233a8a3dbb2b6659a2222 |
|
| |
| == Part 3 ==
| |
|
| |
| <syntaxhighlight lang='python'>
| |
| il = []
| |
| tul = []
| |
| kpl = []
| |
|
| |
| if (0):
| |
|
| |
| kpl.append( '1: Elävä solu ' )
| |
| fil.append( 'bg7_1.csv' )
| |
| tul.append( ['P1', 'P2', 'P3', 'S1', 'T1','YT1'] )
| |
|
| |
| kpl.append( '4: Levät ja planktoneläimet ovat vesien runsaimpia eliöitä' )
| |
| fil.append( 'bg7_4.csv' )
| |
| tul.append( ['P1'] )
| |
|
| |
| name = "name1"
| |
| name = "name2"
| |
|
| |
| if (0):
| |
|
| |
| kpl.append( '3: Metsätyypiy ja puulajit' )
| |
| fil.append( 'bg8_3.csv' )
| |
| tul.append( ['P1', 'P2'] )
| |
|
| |
| name = "name6"
| |
| name = "name7"
| |
|
| |
|
| |
| if (1):
| |
| #9. luokka
| |
| kpl.append( '2: Solut -- elämän legopalikat' )
| |
| fil.append( 'bg9_2.csv' )
| |
| tul.append( ['P1', 'P2', 'S3'] )
| |
|
| |
| kpl.append( '3: Kudokset' )
| |
| fil.append( 'bg9_3.csv' )
| |
| tul.append( ['P1'] )
| |
|
| |
| name = "name11"
| |
| name = "name12"
| |
|
| |
| </syntaxhighlight>
| |
|
| |
| == Part 4 ==
| |
|
| |
| <syntaxhighlight>
| |
| ka = 0
| |
| lkm = 0
| |
| print("\n\n")
| |
| print('Hei')
| |
| print('Biologian tehtäväsi tähän mennessä. Lopussa arvosana seisoo.')
| |
| print('Tarkista ainakin, että olet teet ne tehtävä mitkä olen merkinnyt arvosanalla neljä (4). Jos olet tehnyt, mutta arvosanasi on 4, kerro minulle. ')
| |
| print('Saat parannella ja lisäillä tehtäviä, jos haluat paremman numeron. Aikaa on viikon verran.')
| |
| print('- - - - - - - - - - - - - - - - - - - - -')
| |
| ave = 0
| |
| for i, tcsv in enumerate( fil ):
| |
| lkm = lkm + 1
| |
| names = []
| |
| with open( tcsv ) as csvfile:
| |
| print( kpl[i] )
| |
| print( "-"*len( kpl[i] ) )
| |
| readCSV = csv.reader(csvfile, delimiter=',')
| |
| #Read the column names
| |
| eNames = getExeNames(next(readCSV))
| |
| eNames.insert(0,'Name')
| |
| formats = ['u4']*( len( eNames ) - 1)
| |
| formats.insert(0, 'U30')
| |
| #print( eNames )
| |
|
| |
| # Create the array
| |
| rr = [];
| |
| for row in readCSV:
| |
| r = getRow( row )
| |
| rr.append( tuple(r) )
| |
| points = np.array( (rr), dtype={'names': eNames, 'formats':formats})
| |
| #print( points )
| |
|
| |
| #Create the grading table.
| |
| formatsGrade = ['f4']*( len( eNames ) - 1)
| |
| formatsGrade.insert(0, 'U30')
| |
| grades = np.array( (rr), dtype={'names': eNames, 'formats':formatsGrade})
| |
| #print( grades )
| |
| #print( eNames )
| |
| #print( len( eNames ) )
| |
| for n in eNames[1:]:
| |
| #print( grades[n] )
| |
| grades[n] = grades[n]/ max( max( grades[n] ), 1 )
| |
| grades[n] = np.maximum( np.round( ( 4*( 6/(1-0.1)*(grades[n]-1)+10 ))/4, 2), 4)
| |
| #print( grades )
| |
|
| |
|
| |
| #Get the needed columns (exercises) only
| |
| grades = leaveFields(grades, tul[i])
| |
| #print( grades.dtype.names[1:] )
| |
| #print( grades )
| |
|
| |
|
| |
|
| |
| if 1:
| |
| names = grades['Name']
| |
| nameInd = [j for j,i in enumerate(names) if name.lower() in i.lower()]
| |
| average = 4
| |
| if nameInd:
| |
| nameInd = nameInd[0]
| |
| pp = list( grades[nameInd] )
| |
| print( pp[0] )
| |
| for ni, n in enumerate( grades.dtype.names[1:] ):
| |
| print( "Arvosana: " + str(pp[ni+1]) , end="\t" )
| |
| print(n)
| |
| average = np.round( np.average( pp[1:] ), 1)
| |
| else:
| |
| print("Et ole tehnyt yhtään tehtävää tästä luvusta! Tee vielä:")
| |
| for ni, n in enumerate( grades.dtype.names[1:] ):
| |
| print(n)
| |
|
| |
| print( "-> Keskiarvo: " + str( average ) )
| |
| ave = ave + average
| |
|
| |
| print("\n")
| |
| print('---------------')
| |
| print( 'Kaikkien tehtävien keskiarvo: ', np.round( ave/lkm, 1) )
| |
| print("\n\n")
| |
| </syntaxhighlight>
| |
|
| |
| == Part 5 ==
| |
|
| |
| <syntaxhighlight lang="python">
| |
|
| |
| </syntaxhighlight>
| |
|
| |
| == Part 6 ==
| |
|
| |
| <syntaxhighlight lang="python">
| |
|
| |
| </syntaxhighlight>
| |