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

Adicionando exercício semanal #6

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

Conversation

Fefanez
Copy link

@Fefanez Fefanez commented May 1, 2024

No description provided.

@Fefanez
Copy link
Author

Fefanez commented May 1, 2024

Prof. Suzik, considere o último commit 'Retificando exercícios de sala e de casa', por favor. Os anteriores estavam incorretos.

Obrigada :)

Comment on lines +88 to +103
def melhor_pior_receita():
receita_maior = 0
receita_menor = 0

for el in dataset:
receita = el.get('faturamento') - el.get('despesas')
if receita > receita_maior:
receita_maior = receita
mes_maior = el.get('mes_receita')
ano_maior = el.get('ano_receita')
if receita < receita_menor:
receita_menor = receita
mes_menor = el.get('mes_receita')
ano_menor = el.get('ano_receita')
print(f'A melhor receita foi de R${receita_maior}, obtida no mês {mes_maior} do ano de {ano_maior}.')
print(f'A pior receita foi de R${receita_menor}, obtida no mês {mes_menor} do ano de {ano_menor}.')
Copy link
Collaborator

Choose a reason for hiding this comment

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

interessante , mas no caso era para selecionar o ano que teve a melhor receita e o ano que teve a pior receita.

Comment on lines +76 to +86
def calculo_receita():
ano_escolhido = int(input('Digite o ano que você deseja saber a receita: '))
receita_anual = 0

for el in dataset:
ano_el = (el.get('ano_receita'))
if ano_el == ano_escolhido:
receita = el.get('faturamento') - el.get('despesas')
receita_anual += receita

print(f'No ano de {ano_escolhido}, a receita foi de R${receita_anual}.')
Copy link
Collaborator

Choose a reason for hiding this comment

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

senti falta do mês que teve a maior despesa e maior receita do ano escolhido

'despesas': despesas
}
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.

evite dar print em todos os dados , imagine que como você não tem ideia de quantos registros tem no dataset, exibir todos pode poluir a saída do seu programa.

Pode tentar substituir por um print("Registro adicionado com sucesso")

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.

<3 Parabéns!

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