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

Atividade Semana 05 - Maria Eduarda Bastos de Mello #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

madubmello
Copy link

O que?

  • Resoluções dos exercícios propostos para a semana.

Como?

  • Utilizando os conhecimentos adquiridos nas aulas sobre Projeto Guiado I da professora Suzik.

Comment on lines +120 to +125
for ano in anos_registrados:
receita_anual = 0

for registro in dataset:
if registro.get("ano_receita") == ano:
receita_anual += (registro.get("faturamento") - registro.get("despesas"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

muito bem!

Uma curiosidade: colocar for dentro de for não é muito indicado já que normalmente tem uma performance ruim.

Comment on lines +134 to +140
for elemento in receitas:
if elemento.get("receita") <= melhor_receita:
pior_receita = elemento.get("receita")
pior_ano = elemento.get("ano")
elif elemento.get("receita") >= melhor_receita:
melhor_receita = elemento.get("receita")
melhor_ano = elemento.get("ano")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tratar os dados e depois fazer a condição foi uma boa sacada! parabéns 💯

melhor_receita = elemento.get("receita")
melhor_ano = elemento.get("ano")

print(f"O ano com a melhor receita foi {melhor_ano}, com uma receita final de R${melhor_receita:.2f}.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a conversão para float não é necessária já que só teremos números inteiros. Mas legal saber que sabe usar formatação na string <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