Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LaryssaCunha
Copy link

pull request do desafio

Copy link
Collaborator

@manuellysuzik manuellysuzik left a 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.")
Copy link
Collaborator

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
Copy link
Collaborator

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)
Copy link
Collaborator

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:
Copy link
Collaborator

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}")
Copy link
Collaborator

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?

Comment on lines +124 to +134
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")
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants