fork download
  1. def nota_media(alunos):
  2. soma = 0
  3. for aluno in alunos:
  4. soma += aluno['nota']
  5. return soma / len(alunos)
  6.  
  7. alunos = [{'name': 'Naruto', 'sexo': 'M', 'nota': 5.0}, {'name': 'Sakura ', 'sexo': 'F', 'nota': 10.0}]
  8.  
  9. print(nota_media(alunos)) #7.5
  10.  
Success #stdin #stdout 0.03s 9012KB
stdin
Standard input is empty
stdout
7.5