Advertisement
roneygomes

Cáculo de Média Iterativo

Dec 8th, 2011
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3.  
  4. def media():
  5.     nota_1 = float(raw_input("Entre com a primeira nota: "))
  6.     nota_2 = float(raw_input("Entre com a segunda nota: "))
  7.     nota_3 = float(raw_input("Entre com a terceira nota: "))
  8.     nota_4 = float(raw_input("Entre com a quarta nota: "))
  9.  
  10.     print "A média do aluno é: ", (nota_1 + nota_2 + nota_3 + nota_4) / 4
  11.  
  12.  
  13. alunos = int(raw_input("Entre com a quantidade de alunos: "))
  14.  
  15. for i in range(1, alunos + 1):
  16.     print "\nAluno %d:" %(i)
  17.     media()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement