0
Good morning, you guys.
I need help to solve a part of the college exercise. The problem is relatively simple, but I’m having difficulties.
My code is this:
# Subprogramas
def verifica_peso(pesos):
if pesos > 10:
print("A soma dos pesos é maior do que 10.")
# Programa Principal
a, b, c, d, e = map(float, input().split()) # Definindo o peso das notas.
pesos = (a + b + c + d + e)
verifica_peso(pesos)
qnt_candidatos = int(input())
And what I need to do now is allow the user to enter, by input(), with the name, age and 5 candidate grades, all in the same input. Example of the input:
Ana 30 8.3 4.5 9.2 4.0 6.6
João 25 2.0 3.4 8.9 7.2 4.4
Pedro 30 7.8 5.0 9.2 6.0 4.6
Maria 28 5.0 6.0 7.0 5.0 4.0
Thiago 40 6.5 4.5 7.0 4.5 4.5
Raquel 26 10.0 10.0 10.0 10.0 10.0
Then I will need to use the information of the grades to make the average and age as a tiebreaker.
I thought about using Dict(), but I don’t know exactly how it would apply. Can you help me?
Grateful for the attention!
What’s the problem? I don’t understand the difficulty.
– Woss
I’m not able to generate the list, every time I try the Pycharm gives some error, or when I get the list, I have problems to average. Wanted an idea of how to do.
– Caio Tracera
But you come in with the name and age too, right? Why don’t you catch them on
input
also? There are only weights there.– Woss