Skip to content

Instantly share code, notes, and snippets.

@ricardosilva86
Last active November 5, 2020 17:54
Show Gist options
  • Save ricardosilva86/8967c7023d6bbcb2cfb9d2b87f4cafab to your computer and use it in GitHub Desktop.
Save ricardosilva86/8967c7023d6bbcb2cfb9d2b87f4cafab to your computer and use it in GitHub Desktop.
Exercicio de Python
nota1 = float(input())
nota2 = float(input())
nota3 = float(input())
presenca = float(input())
presenca_int = int(presenca * 100) #o valor da presenca é convertido em percentual
media = (nota1*2 + nota2*2 + nota3*3) /(2+2+3) #aqui é uma média ponderada, o peso de cada nota precisa ser contabilizado
if (presenca_int <= 74):
print("Frequencia: " + str(presenca_int) +"%")
print("Media: " + str(format(media, '.1f')))
print("Aluno reprovado por faltas!")
elif(round(media, 1) > 9.0 and presenca_int >= 75): #o uso do round() é necessário, pois a média pode não funcionar sem o arredondamento
print("Frequencia: " + str(presenca_int) +"%")
print("Media: " + str(format(media, '.1f')))
print("Aluno aprovado com louvor!")
elif(round(media, 1) >= 6.0 and round(media, 1) <= 9.0 and presenca_int >= 75):
print("Frequencia: " + str(presenca_int) +"%")
print("Media: " + str(format(media, '.1f')))
print("Aluno aprovado!")
elif(round(media, 1) >= 4.0 and round(media, 1) < 6.0 and presenca_int >= 75):
print("Frequencia: " + str(presenca_int) +"%")
print("Media: " + str(format(media, '.1f')))
print("Aluno de rec!")
else:
print("Frequencia: " + str(presenca_int) +"%")
print("Media: " + str(format(media, '.1f')))
print("Aluno reprovado!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment