abv

 avatar
unknown
abc
3 years ago
3.8 kB
30
Indexable
def kyselijä():
    väliaika  = []
    TA = []
    TB = []
    pisteet =[]
    
    while True:
        
        t = input("Koepisteet ja harjoitusten määrä: ")
        if t != "":
            väliaika = väliaika + (t.split(" "))
        else:
            break
    
    T1 = väliaika[::2]
    T2 = väliaika[1::2]

    for x in T1:
        koepisteetG.append(int(x))
    for x in T2:
        harjoitusmG.append(int(x))
    
    #koepisteetG.append(TA)
    #harjoitusmG.append(TB)
    return


def hylätty(koepisteet):
    
    for x in koepisteet:
        if x < 10:
            hylätyt.append(x)
    print(hylätyt)



def harjoitusP(harjoituspisteet):
    
    
    pisteet2 = []
    
    
    for x in harjoituspisteet:
        if x <10:
            pisteet2.append(0)
        if x >= 10 and x < 20:
            pisteet2.append(1)
        if x >= 20 and x < 30:
            pisteet2.append(2)
        if x >= 30 and x < 40:
            pisteet2.append(3)
        if x >= 40 and x < 50:
            pisteet2.append(4)
        if x >= 50 and x < 60:
            pisteet2.append(5)
        if x >= 60 and x < 70:
            pisteet2.append(6)
        if x >= 70 and x < 80:
            pisteet2.append(7)
        if x >= 80 and x < 90:
            pisteet2.append(8)
        if x >= 90 and x < 100:
            pisteet2.append(9)
        if x == 100:
            pisteet2.append(10)
    for x in pisteet2:
        harjoituspisteetuusi.append(x)
    return

def yhteenlaskettuna(lista1, lista2):
    tulos = []
    for i in range(len(lista1)):
        tulokset.append(lista1[i] + lista2[i])
    

def arvosana(A, B):
    laskuri = 0
    for x in A:
    
        if B[laskuri] <10:
            arvosanat.append(0)
        else:
            if x <= 14:
                arvosanat.append(0)
            if x >= 15 and x <= 17:
                arvosanat.append(1)
            if x >=18 and x <= 20:
                arvosanat.append(2)
            if x >= 21 and x <= 23:
                arvosanat.append(3)
            if x >= 24 and x <= 27:
                arvosanat.append(4)
            if x >= 28 and x <= 30:
                arvosanat.append(5)
        laskuri += 1

def lopuksi(tulokset, arvosanat):
    
    keskiarvo1 = 0   #57
      #57 / 2
    hylätty = 0
    vm = arvosanat.count(5) * "*"
    nm = arvosanat.count(4) * "*"
    km = arvosanat.count(3) * "*"
    kkm  = arvosanat.count(2) * "*"
    ym = arvosanat.count(1) * "*"
    om = arvosanat.count(0) * "*"
    for x in tulokset:
        keskiarvo1 += x
    for x in arvosanat:
        if x == 0:
            hylätty += 1
        
    keskiarvo = keskiarvo1 / len(tulokset) 
    epäonnistumisprosentti = hylätty / (len(arvosanat) )
    hyväksymisprosentti = 100 - epäonnistumisprosentti * 100
    
    print("Tilasto:")
    print(f"Pisteiden keskiarvo: {keskiarvo:.1f}")
    if hylätty != 0:
        if len(arvosanat) == 1:
           print(f"Hyväksymisprosentti: 0.0") 
        else:
            print(f"Hyväksymisprosentti: {hyväksymisprosentti:.1f}")
    if hylätty == 0:
        print(f"Hyväksymisprosentti: 100.0")  
    print(f"Arvosanajakauma: ")
    print(f"5: {vm}")
    print(f"4: {nm}") 
    print(f"3: {km}")
    print(f"2: {kkm}")
    print(f"1: {ym}")
    print(f"0: {om}")
    return



hylätyt = []
arvosanat = []
tulokset = []
harjoituspisteetuusi = []        
harjoitusmG = []  #tämä on vanha tieto harjoitusten määrästä 
koepisteetG = [] # pisteet kokeista
kyselijä()
harjoitusP(harjoitusmG)
yhteenlaskettuna(koepisteetG, harjoituspisteetuusi)
arvosana(tulokset, koepisteetG)
lopuksi(tulokset, arvosanat)
Editor is loading...