1
I’m trying to build a function for calculating multi-note averages, but error occurs when I try to pass this data to a dictionary.
The system claims that the class of data that I try to pass is not compatible, but I’ve done it a few times, in other programs, and that didn’t used to happen.
Follows the code:
def Media():
    Notas = {'Total:', 'Maior:', 'Menor:', 'Média:', 'Situação:'}
    
    Valor = 0
    P = 1
    Soma = 0
    c = 0
    
    while True:
        while True:
            N = str(input(f'Digite a {P}° nota: '))
            if N.isnumeric():
                Valor = float(N)
                break
            else:
                print('ERRO! Digite um valor númerico!')
        for c in range(0,1):
            Maior = Menor = Valor
            c += 1
        if Valor >= Maior:
            Notas['Maior:'] = Maior
            P += 1
            Soma += Valor
        elif Valor <= Menor:
            Notas['Menor:'] = Menor
            P += 1
            Soma += Valor
    
    
        R = str(input('Deseja inserir outro valor?' )).upper()
        if R not in 'SN':
            print('Digite uma resposta válida!')
        if R == 'N':
            break
    Media = Soma / P
    if Media < 6:
        Notas['Situação:'] = 'Tá tensa!'
    if Media > 6:
        Notas['Situação:'] = 'Ta tranquila.'
    Notas['Média:'] = Media 
    Notas['Total:'] = P
   print(Notas)
print(30 * '-')
print('CALCULADOR DE MÉDIAS DOS ALUNOS')
print(30 * '-')
print('Um momento que o sistema está iniciando...')
sleep(0.3)
Media()