Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def registrar(x, y):
- while x == 0:
- print('\nRegistrar um aluno = 0')
- print('Cancelar = 1')
- y = int(input('\nEscolha uma opção acima: '))
- if y == 0:
- while y == 0:
- nome = input('\nInforme o nome: ')
- nota = float(input('Informe a nota: '))
- matricula = int(input('Informe o número de matricula: '))
- if matricula < 0:
- print('\nO número de matricula não pode ser negativo!')
- y = 0
- else:
- listaalunos.append(nome)
- listanotas.append(nota)
- listamatriculas.append(matricula)
- print('\nAluno Registrado!')
- y = 1
- elif y == 1:
- x = 1
- else:
- print('\nEscolha uma opção válida.')
- def media():
- soma = 0
- tamanho = 0
- for i in listanotas:
- soma = soma + i
- tamanho = tamanho + 1
- media = soma / tamanho
- return media
- if __name__ == '__main__':
- listaalunos = []
- listanotas = []
- listamatriculas = []
- x = 0
- y = 0
- registrar(x,y)
- print('A média é {}'.format(media()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement