-
Notifications
You must be signed in to change notification settings - Fork 29
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
resolução-desafio-laryssa #16
base: main
Are you sure you want to change the base?
Conversation
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.
GG
elif opt == "3": | ||
calcular_receita_geral() | ||
elif opt == "0": | ||
print("Encerramos o programa! Volte sempre.") |
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.
acho que precisa ter um break aqui para encerrar o programa
print("Encerramos o programa! Volte sempre.") | ||
else: ##Adicione uma condição para caso o usuário não digite uma opção válida no menu. | ||
print("Você não selecionou nenhuma opção válida.") | ||
break |
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.
esse break aqui está encerrando seu programa depois a execução de uma das opções do menu
|
||
#adicionando o novo registro na memória da lista. | ||
dataset.append(novo_registro) | ||
print(dataset) |
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.
Tente evitar mostrar todo o dataset depois de adicionar um registro. Afinal, não sabemos quantos registros podem conter em um dataset então printa-los pode poluir a saída do terminal com dados difíceis de se ler.
Uma dica: pode substituir por print("Registro adicionado com sucesso!")
maior_lucro = receita # encontrando o maior lucro | ||
mes_lucro = item.get("mes_receita") # convertendo o valor do maior lucro pra encontrar o mês em que ele foi encontrado. | ||
|
||
if maior_despesas > receita: |
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.
mas queremos apenas a maior despesa. Certo? Dessa forma está comparando com a receita e não apenas com a despesa.
maior_despesas = receita | ||
mes_gasto = item.get("mes_receita") | ||
|
||
print(f"A diferença entre o lucro e o gasto do {ano} é de {valor_total}") |
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.
na verdade é: a soma das diferenças entre o lucro e as despesas é:
certo?
if item.get("ano_receita"): | ||
lucro_liquido = item.get("faturamento") - item.get("despesas") | ||
receita_maior += lucro_liquido | ||
|
||
if lucro_liquido > ano_maior_lucro: | ||
ano_maior_lucro = lucro_liquido | ||
ano_melhor_lucro = item.get("ano_receita") | ||
|
||
if lucro_liquido < ano_menor_lucro: | ||
ano_menor_lucro = lucro_liquido | ||
ano_pior_lucro = item.get("ano_receita") |
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.
não é exatamente assim que funciona. Mas parabéns por tentar <3
pull request do desafio