Advertisement
Guest User

escola 2

a guest
Sep 20th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. lst = []
  2. dic ={}
  3. opçao = ' '
  4. cont = 0
  5. while True:
  6. print('________CADASTRO DE ALUNOS______')
  7. print('''O que deseja fazer?
  8. [A] cadastra.
  9. [B] listar cadastro.
  10. [C] sair.''')
  11.  
  12. opçao = str(input('O que deseja fazer?.A,b ou C: ')).strip().upper()[0]
  13. while opçao not in 'ABC':
  14. opçao = str(input('NÃO INTENDIE!!!! \n O que deseja fazer?.A,b ou C: ')).strip().upper()[0]
  15. if opçao == 'B' and cont == 0:
  16. print('ERRO !!! VC AINDA NAO TEM ALUNOS CADASTRADOS PARA LISTAR.')
  17. break
  18.  
  19. if opçao =='B' and cont > 0:
  20. print(lst)
  21. break
  22. if opçao == 'C':
  23. break
  24.  
  25.  
  26. dic.clear()
  27. nome = str(input('nome: '))
  28. idade =int(input('idade: '))
  29. nota =float(input('nota: '))
  30.  
  31. dic['nome']=nome
  32. dic['idade']=idade
  33. dic['nota']= nota
  34.  
  35. lst.append(dic.copy())
  36. cont += 1
  37.  
  38. print(f'____OS ALUNOS CADASTRADOS NO TOTAL SÃO : {len(lst)}:')
  39. for i in range(len(lst)):
  40. print(f'''CADASTRO ALUNO {i} :
  41. NOME:{lst[i]['nome']}
  42. IDADE: {lst[i]['idade']}
  43. NOTA: {lst[i]['nota']}''')
  44. print('#'*90)
  45. print('#'*90)
  46. print('FIM OBRIGADO !!!!!!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement