-4
I am creating a program, using Python 3.5, to calculate average, but in my school there are some subjects with two teachers, and each one gives a different test.
The problem is that the code I created averages (Prova 1 + Prova 2)/2
, which is equal to media1
, (Atividade 1 + Atividade 2)/2
, which is equal to average 2, and the final average is with Simulated (media1+media2+simulado)/3
, and when it’s a matter I don’t put anything on P2 it’s a mistake. I was thinking, when the user enters the matter name run such code, and another name, another code, how do I do this?
My code:
nota1 = float(input("Nota1: "))
nota2 = float(input('Nota 2: '))
simulado = float(input('Nota simulado: '))
ac1 = float(input('Nota AC1: '))
ac2 = float(input('Nota AC2: '))
media1 = (nota1+nota2)/2
mediaAC = (ac1+ac2)/2
mediaf = (media1+simulado+mediaAC)/3
print (mediaf)
if mediaf == 6:
print("na media")
if mediaf < 6:
print("abaixo da media")
Hello @gust4vo, you could put the code you have built and what you have tried in your question?
– Vinicius Zaramella
Okay, I’ve entered the code.
– gust4vo
What error are you getting? Detail a little more...
– Christian Felipe
It is not a mistake, I wanted to know how to do for when, for example, a variable is equal to Matematica, a certain code is executed (if mathematics has 2 proofs, the code with average for two subjects is executed), and if it is a subject with a proof, the code of that average is executed. I tried to leave P2 space blank, but the error was this: Traceback (Most recent call last): File "C: Users gusta Appdata Local Programs Python Python35-32 notateste.py", line 2, in <module> nota2 = float('Note 2: ')) Valueerror: could not Convert string to float:
– gust4vo
@gust4vo, change the title with a summary of your doubt, for other users to identify your doubt and be able to help you too. Abracos!
– Guilherme IA