-
Notifications
You must be signed in to change notification settings - Fork 38
Entrega do Projeto Guiado #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9623186
7b84ea9
025d811
9e773a9
6b18e3d
cf1c17d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,213 @@ | ||||||||||||||||||||||
| dataset = { | ||||||||||||||||||||||
| ("Ana", "Silva"): { | ||||||||||||||||||||||
| "Turma": "Turma A", | ||||||||||||||||||||||
| "Notas": [7.5, 8.0, 9.0], | ||||||||||||||||||||||
| "Presença": [True, True, False, True, True], | ||||||||||||||||||||||
| "Participação": 8.5 | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| ("Mariana", "Santos"): { | ||||||||||||||||||||||
| "Turma": "Turma B", | ||||||||||||||||||||||
| "Notas": [6.0, 7.5, 8.5], | ||||||||||||||||||||||
| "Presença": [True, True, True, False, True], | ||||||||||||||||||||||
| "Participação": 5.0 | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| ("Carla", "Oliveira"): { | ||||||||||||||||||||||
| "Turma": "Turma A", | ||||||||||||||||||||||
| "Notas": [8.0, 7.5, 8.5], | ||||||||||||||||||||||
| "Presença": [True, True, True, False, False], | ||||||||||||||||||||||
| "Participação": 8.2 | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| ("Juliana", "Ferreira"): { | ||||||||||||||||||||||
| "Turma": "Turma C", | ||||||||||||||||||||||
| "Notas": [9.0, 8.5, 7.0], | ||||||||||||||||||||||
| "Presença": [True, True, True, True, True], | ||||||||||||||||||||||
| "Participação": 8.7 | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| ("Patrícia", "Souza"): { | ||||||||||||||||||||||
| "Turma": "Turma B", | ||||||||||||||||||||||
| "Notas": [5.0, 5.0, 5.0], | ||||||||||||||||||||||
| "Presença": [True, False, True, True, True], | ||||||||||||||||||||||
| "Participação": 7.2 | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| ("Aline", "Martins"): { | ||||||||||||||||||||||
| "Turma": "Turma A", | ||||||||||||||||||||||
| "Notas": [8.5, 8.0, 9.0], | ||||||||||||||||||||||
| "Presença": [True, True, True, True, True], | ||||||||||||||||||||||
| "Participação": 8.5 | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| ("Fernanda", "Costa"): { | ||||||||||||||||||||||
| "Turma": "Turma C", | ||||||||||||||||||||||
| "Notas": [6.5, 7.0, 8.0], | ||||||||||||||||||||||
| "Presença": [True, True, True, False, True], | ||||||||||||||||||||||
| "Participação": 7.2 | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| ("Camila", "Pereira"): { | ||||||||||||||||||||||
| "Turma": "Turma B", | ||||||||||||||||||||||
| "Notas": [7.5, 8.0, 8.5], | ||||||||||||||||||||||
| "Presença": [True, True, True, True, True], | ||||||||||||||||||||||
| "Participação": 8.0 | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| ("Luana", "Rodrigues"): { | ||||||||||||||||||||||
| "Turma": "Turma A", | ||||||||||||||||||||||
| "Notas": [9.0, 9.0, 8.5], | ||||||||||||||||||||||
| "Presença": [True, True, True, True, True], | ||||||||||||||||||||||
| "Participação": 8.8 | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| ("Beatriz", "Lima"): { | ||||||||||||||||||||||
| "Turma": "Turma C", | ||||||||||||||||||||||
| "Notas": [8.0, 7.5, 7.0], | ||||||||||||||||||||||
| "Presença": [True, True, True, False, True], | ||||||||||||||||||||||
| "Participação": 7.5 | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def main(): | ||||||||||||||||||||||
| print("\n--- Seja bem vinda a Escola do Reprograma! ---") | ||||||||||||||||||||||
| print("Sistema de informações de alunas") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| while True: | ||||||||||||||||||||||
| cod_opcao = obter_opcao() | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if cod_opcao == 1: incluir_nova_aluna() | ||||||||||||||||||||||
| elif cod_opcao == 2: consultar_lista_alunas() | ||||||||||||||||||||||
| elif cod_opcao == 3: consultar_faltas_aluna() | ||||||||||||||||||||||
| elif cod_opcao == 4: consultar_notas_aluna() | ||||||||||||||||||||||
| elif cod_opcao == 5: consultar_status_aprovacao() | ||||||||||||||||||||||
| elif cod_opcao == 6: print("Encerrando o programa..."); break | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def obter_opcao(): | ||||||||||||||||||||||
| codigo_opcao = 0 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| while codigo_opcao not in [1, 2, 3, 4, 5, 6]: | ||||||||||||||||||||||
| try: | ||||||||||||||||||||||
| codigo_opcao = int(input("\nEscolha uma opção:\n" | ||||||||||||||||||||||
| "1 - Incluir uma nova aluna\n" | ||||||||||||||||||||||
| "2 - Consultar lista de alunas\n" | ||||||||||||||||||||||
| "3 - Consultar faltas da aluna\n" | ||||||||||||||||||||||
| "4 - Consultar notas da aluna\n" | ||||||||||||||||||||||
| "5 - Consultar status de aprovação\n" | ||||||||||||||||||||||
| "6 - Sair do sistema\n" | ||||||||||||||||||||||
| "Opção: ")) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if codigo_opcao not in [1, 2, 3, 4, 5, 6]: | ||||||||||||||||||||||
| print("Opção inválida. Por favor, escolha uma opção válida (1 a 6).\n") | ||||||||||||||||||||||
| except ValueError: | ||||||||||||||||||||||
| print("Entrada inválida. Por favor, digite um número inteiro de 1 a 6.\n") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| return codigo_opcao | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def lista_de_presenca(): | ||||||||||||||||||||||
| qntdd_de_aulas = input("Quantas aulas a aluna teve? ") | ||||||||||||||||||||||
| aulas = [] | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remover excesso de linhas :) |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| for contador in range(int(qntdd_de_aulas)): | ||||||||||||||||||||||
| while True: | ||||||||||||||||||||||
| entrada = input(f"Insira a presença da aula. Considere True=presença e False=falta, #{contador + 1}: ") | ||||||||||||||||||||||
| try: | ||||||||||||||||||||||
| presenca = eval(entrada) | ||||||||||||||||||||||
| aulas.append(presenca) | ||||||||||||||||||||||
| break | ||||||||||||||||||||||
| except NameError: | ||||||||||||||||||||||
| print("Entrada inválida. Por favor, insira True ou False.") | ||||||||||||||||||||||
|
Comment on lines
+105
to
+117
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ótima implementação da aula de sábado, parabéns! |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| return presenca | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def lista_de_notas(): | ||||||||||||||||||||||
| qntdd_de_notas = (input("Quantas notas quer inserir? ")) | ||||||||||||||||||||||
| notas = [] | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| for contador in range(int(qntdd_de_notas)): | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| while True: | ||||||||||||||||||||||
| entrada = input(f"Insira a nota {contador + 1}: ") | ||||||||||||||||||||||
| try: | ||||||||||||||||||||||
| nota = float(entrada) | ||||||||||||||||||||||
| notas.append(nota) | ||||||||||||||||||||||
| break | ||||||||||||||||||||||
| except: | ||||||||||||||||||||||
| print("Entrada inválida. Insira uma nota de 0 a 10. ") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| return notas | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def incluir_nova_aluna(): | ||||||||||||||||||||||
| print("Insira os seguintes dados: ") | ||||||||||||||||||||||
| nome = input("Nome da aluna: ") | ||||||||||||||||||||||
| sobrenome = input("Sobrenome: ") | ||||||||||||||||||||||
| turma = input("Turma: ") | ||||||||||||||||||||||
| notas = lista_de_notas() | ||||||||||||||||||||||
| lista_presenca = lista_de_presenca() | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| while True: | ||||||||||||||||||||||
| nota_participacao = (input("Qual foi a nota de participação da aluna? ")) | ||||||||||||||||||||||
| try: | ||||||||||||||||||||||
| nota_participacao = float(nota_participacao) | ||||||||||||||||||||||
| break | ||||||||||||||||||||||
| except: | ||||||||||||||||||||||
| print("Entrada inválida. Insira uma nota de 0 a 10. ") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
Comment on lines
+154
to
+156
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Acredito que aqui faltou a implementação de salvar os dados da aluna no dicionário. A parte de cima está toda correta, com as validações e captura de dados do usuário. Mas precisa ter a parte de salvar os dados da aluna. Ponto de atenção: É importante testar suas funções com os dados que você acabou de inserir no dicionário também. Pois aqui temos duas validações importantes, inclusão da aluna e consulta de informações desta aluna. Sugestão:
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| print(f"A aluna {nome} {sobrenome} foi cadastrada com sucesso: ") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| return nome | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def consultar_lista_alunas(): | ||||||||||||||||||||||
| print(dataset.keys()) | ||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aqui podemos formatar a tupla para que possa listar os nomes e sobrenomes: Sugestão:
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def consultar_faltas_aluna(): | ||||||||||||||||||||||
| try: | ||||||||||||||||||||||
| nome = input("Nome da aluna: ") | ||||||||||||||||||||||
| sobrenome = input("Sobrenome da aluna: ") | ||||||||||||||||||||||
| lista_de_presenca = dataset[(nome,sobrenome)]["Presença"] | ||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Podemos usar a função de count para contar a quantidade de "False" - faltas - dentro da nossa lista booleana. Sugestão:
Suggested change
|
||||||||||||||||||||||
| print(f"A aluna {nome} {sobrenome} está com {lista_de_presenca}") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| except: | ||||||||||||||||||||||
| print("Aluna não encontrada. ") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def consultar_notas_aluna(): | ||||||||||||||||||||||
| try: | ||||||||||||||||||||||
| nome = input("Nome da aluna: ") | ||||||||||||||||||||||
| sobrenome = input("Sobrenome da aluna: ") | ||||||||||||||||||||||
| lista_de_notas = dataset[(nome,sobrenome)]["Notas"] | ||||||||||||||||||||||
| print(f"A aluna {nome} {sobrenome} está com {lista_de_notas}") | ||||||||||||||||||||||
|
Comment on lines
+179
to
+182
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excelente implementação! :) |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| except: | ||||||||||||||||||||||
| print("Aluna não encontrada. ") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def consultar_status_aprovacao(): | ||||||||||||||||||||||
| nome = input("Qual nome da aluna gostaria de consultar o status de aprovação? : ") | ||||||||||||||||||||||
| sobrenome = input("Qual sobrenome da aluna gostaria de consultar o status de aprovação? : ") | ||||||||||||||||||||||
| try: | ||||||||||||||||||||||
| notas = dataset[(nome, sobrenome)]["Notas"] | ||||||||||||||||||||||
| participacao = dataset[(nome, sobrenome)]["Participação"] | ||||||||||||||||||||||
| media = sum(notas) / len(notas) | ||||||||||||||||||||||
| presenca = dataset[(nome, sobrenome)]["Presença"] | ||||||||||||||||||||||
| percentual_presenca = (presenca.count(True) / len(presenca)) * 100 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if percentual_presenca < 80: | ||||||||||||||||||||||
| print("A aluna está reprovada por falta. ") | ||||||||||||||||||||||
| elif media < 6: | ||||||||||||||||||||||
| print("A aluna está reprovada por nota. ") | ||||||||||||||||||||||
| elif participacao < 6: | ||||||||||||||||||||||
| print("A aluna está reprovada por nota de participação. ") | ||||||||||||||||||||||
| else: | ||||||||||||||||||||||
| print("A aluna está aprovada. ") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| print(f"A aluna {nome} {sobrenome} está com média final de {media}") | ||||||||||||||||||||||
|
Comment on lines
+191
to
+207
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bom trabalho no cálculo de aprovação da aluna, adorei que você separou por tipos de reprovação dentro da função! ♥ |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| except KeyError: | ||||||||||||||||||||||
| print("Não foi possível consultar o status de aprovação, a aula não conta no sistema. ") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| main() | ||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| dataset = { | ||
| ("Ana", "Silva"): { | ||
| "Turma": "Turma A", | ||
| "Notas": [7.5, 8.0, 9.0], | ||
| "Presença": [True, True, False, True, True], | ||
| "Participação": 8.5 | ||
| }, | ||
| ("Mariana", "Santos"): { | ||
| "Turma": "Turma B", | ||
| "Notas": [6.0, 7.5, 8.5], | ||
| "Presença": [True, True, True, False, True], | ||
| "Participação": 7.2 | ||
| }, | ||
| ("Carla", "Oliveira"): { | ||
| "Turma": "Turma A", | ||
| "Notas": [8.0, 7.5, 8.5], | ||
| "Presença": [True, True, True, True, True], | ||
| "Participação": 8.2 | ||
| }, | ||
| ("Juliana", "Ferreira"): { | ||
| "Turma": "Turma C", | ||
| "Notas": [9.0, 8.5, 7.0], | ||
| "Presença": [True, True, True, True, True], | ||
| "Participação": 8.7 | ||
| }, | ||
| ("Patrícia", "Souza"): { | ||
| "Turma": "Turma B", | ||
| "Notas": [7.0, 7.0, 7.5], | ||
| "Presença": [True, False, True, True, True], | ||
| "Participação": 7.2 | ||
| }, | ||
| ("Aline", "Martins"): { | ||
| "Turma": "Turma A", | ||
| "Notas": [8.5, 8.0, 9.0], | ||
| "Presença": [True, True, True, True, True], | ||
| "Participação": 8.5 | ||
| }, | ||
| ("Fernanda", "Costa"): { | ||
| "Turma": "Turma C", | ||
| "Notas": [6.5, 7.0, 8.0], | ||
| "Presença": [True, True, True, False, True], | ||
| "Participação": 7.2 | ||
| }, | ||
| ("Camila", "Pereira"): { | ||
| "Turma": "Turma B", | ||
| "Notas": [7.5, 8.0, 8.5], | ||
| "Presença": [True, True, True, True, True], | ||
| "Participação": 8.0 | ||
| }, | ||
| ("Luana", "Rodrigues"): { | ||
| "Turma": "Turma A", | ||
| "Notas": [9.0, 9.0, 8.5], | ||
| "Presença": [True, True, True, True, True], | ||
| "Participação": 8.8 | ||
| }, | ||
| ("Beatriz", "Lima"): { | ||
| "Turma": "Turma C", | ||
| "Notas": [8.0, 7.5, 7.0], | ||
| "Presença": [True, True, True, False, True], | ||
| "Participação": 7.5 | ||
| } | ||
| } | ||
|
|
||
| def lista_de_presenca(): | ||
| qntdd_de_aulas = input("Quantas aulas a aluna teve? ") | ||
| aulas = [] | ||
|
|
||
|
|
||
| for contador in range(int(qntdd_de_aulas)): | ||
| while True: | ||
| entrada = input(f"Insira a presença da aula. Considere True=presença e False=falta, #{contador + 1}: ") | ||
| try: | ||
| presenca = eval(entrada) | ||
| aulas.append(presenca) | ||
| break | ||
| except NameError: | ||
| print("Entrada inválida. Por favor, insira True ou False.") | ||
|
|
||
| return presenca | ||
|
|
||
| lista_de_presenca() | ||
|
|
||
| def consultar_notas_aluna(): | ||
| try: | ||
| nome = input("Nome da aluna: ") | ||
| sobrenome = input("Sobrenome da aluna: ") | ||
| lista_de_notas = dataset[(nome,sobrenome)]["Notas"] | ||
| print(f"A aluna {nome} {sobrenome} está com {lista_de_notas}") | ||
|
|
||
| except: | ||
| print("Aluna não encontrada. ") | ||
|
|
||
| qtd_faltas = dataset[(nome)]["Presença"].count(False) | ||
| qtd_aulas = len(dataset[(nome)]["Presença"]) | ||
| percentual_de_faltas = (qtd_faltas / qtd_aulas) * 80 | ||
|
|
||
| #nome = dataset[(nome)] | ||
| #sobrenome = dataset[(sobrenome)] | ||
| lista_de_notas = dataset[(nome)]["Notas"] | ||
| media = float(sum(notas)/len(notas)) | ||
| nota_participacao = dataset[(nome, sobrenome)]["Participação"] | ||
| presenca = dataset[(nome, sobrenome)]["Presença"] | ||
| faltas = dataset[(nome, sobrenome)]["Presença"].count(False) | ||
|
|
||
| if media < 6: | ||
| print ("Aluna está reporvada. ") | ||
| elif nota_participacao < 6: | ||
| print ("Aluna está reporvada. ") | ||
| elif faltas > 2: | ||
| print("Aluna está reporvada. ") | ||
| else: | ||
| print("Aluna aprovada. ") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| dataset = { | ||
| ("Ana", "Silva"): { | ||
| "Turma": "Turma A", | ||
| "Notas": [7.5, 8.0, 9.0], | ||
| "Presença": [True, True, False, True, True], | ||
| "Participação": 8.5 | ||
| }, | ||
| ("Mariana", "Santos"): { | ||
| "Turma": "Turma B", | ||
| "Notas": [6.0, 7.5, 8.5], | ||
| "Presença": [True, True, True, False, True], | ||
| "Participação": 7.2 | ||
| }, | ||
| ("Carla", "Oliveira"): { | ||
| "Turma": "Turma A", | ||
| "Notas": [8.0, 7.5, 8.5], | ||
| "Presença": [True, True, True, True, True], | ||
| "Participação": 8.2 | ||
| }, | ||
| ("Juliana", "Ferreira"): { | ||
| "Turma": "Turma C", | ||
| "Notas": [9.0, 8.5, 7.0], | ||
| "Presença": [True, True, True, True, True], | ||
| "Participação": 8.7 | ||
| }, | ||
| ("Patrícia", "Souza"): { | ||
| "Turma": "Turma B", | ||
| "Notas": [7.0, 7.0, 7.5], | ||
| "Presença": [True, False, True, True, True], | ||
| "Participação": 7.2 | ||
| }, | ||
| ("Aline", "Martins"): { | ||
| "Turma": "Turma A", | ||
| "Notas": [8.5, 8.0, 9.0], | ||
| "Presença": [True, True, True, True, True], | ||
| "Participação": 8.5 | ||
| }, | ||
| ("Fernanda", "Costa"): { | ||
| "Turma": "Turma C", | ||
| "Notas": [6.5, 7.0, 8.0], | ||
| "Presença": [True, True, True, False, True], | ||
| "Participação": 7.2 | ||
| }, | ||
| ("Camila", "Pereira"): { | ||
| "Turma": "Turma B", | ||
| "Notas": [7.5, 8.0, 8.5], | ||
| "Presença": [True, True, True, True, True], | ||
| "Participação": 8.0 | ||
| }, | ||
| ("Luana", "Rodrigues"): { | ||
| "Turma": "Turma A", | ||
| "Notas": [9.0, 9.0, 8.5], | ||
| "Presença": [True, True, True, True, True], | ||
| "Participação": 8.8 | ||
| }, | ||
| ("Beatriz", "Lima"): { | ||
| "Turma": "Turma C", | ||
| "Notas": [8.0, 7.5, 7.0], | ||
| "Presença": [True, True, True, False, True], | ||
| "Participação": 7.5 | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O dicionário já estava definido e importado, essa parte não precisava ter alterado. Do mesmo modo que você usou os dados deste dicionário chamado dataset, você poderia ter usado usando esta notação:
O único ponto de atenção é que o arquivo precisa estar na mesma pasta.
Sugestão: