4
I started programming a little while ago and I’m doing some Python exercises.
The problem is that the result variable always returns "Approved" even when the concept is "D" or "E".
I’ve broken my head a lot and I can’t see the error.
Do a program that reads the two partial grades earned by a student in a discipline over a semester, and calculate their average. The assignment of concepts follows the table below: Mean of Concept Harnessing Between 9.0 and 10.0 A Between 7.5 and 9.0 B Between 6.0 and 7.5 C Between 4.0 and 6.0 D Between 4.0 and zero E The algorithm shall display the notes, the mean, the corresponding concept and the "OK" message on the screen if the concept is A, B or C or "FAILED" if the concept is D or E.
nota1=float(input("Digite nota 1: "))
nota2=float(input("Digite nota 2: "))
media=(nota1+nota2)/2
if media >=9:
conceito = "A"
elif media >= 7.5:
conceito = "B"
elif media >= 6:
conceito = "C"
elif media >= 4:
conceito = "D"
elif media >= 0:
conceito = "E"
if conceito == "A" or "B" or "C":
resultado = "Aprovado!"
elif conceito == "D" or "E":
resultado = "Reprovado"
print("Nota 1: %.2f\nNota 2:%.2f"%(nota1,nota2))
print("Média: %.2f"%media)
print("Conceito: %s"%conceito)
print("Resultado: %s"%resultado)
Antony, please also explain the reason for the change. Not all users will have the abstraction level enough to understand the difference between the codes.
– Woss