Skip to content

Solution/final project #103

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

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

Conversation

Danielef12
Copy link

Propongo la mia risoluzione di questo progetto

.DS_Store Outdated
Copy link

Choose a reason for hiding this comment

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

this file should not be committed, make attention to what is added and, if there are file to not be considered, add them to the .gitignore to avoid to push them eventually in others commit

print("-" * 60)
print(f"\n- Protein: {total_protein_day:.0f}g")
print(f"- Carbs: {total_carbs_day:.0f}g")
print(f"- Fat: {total_fat_day:.0f}g\n\n")
Copy link

@effedib effedib May 25, 2025

Choose a reason for hiding this comment

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

using the :.0f notation the number will be truncated before the comma even if the numer is x.99, can you find a better solution to handle float to round to int?

total_fat_day = breakfast_fat + snak_fat + lunch_fat + dinner_fat
total_protein_day = int(breakfast_protein + snak_protein + lunch_protein + dinner_protein)
total_carbs_day = int(breakfast_carbs +snak_carbs + lunch_carbs + dinner_carbs)
total_fat_day = int(breakfast_fat + snak_fat + lunch_fat + dinner_fat)
Copy link

Choose a reason for hiding this comment

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

making an explicit cast from float to int you obtain exacly the same number truncated... retry with a better solution, don't be hasty and, most important, test your changes before pushing them

Copy link
Author

Choose a reason for hiding this comment

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

among all the float to int conversion methods, the most reliable one already included in python, I would choose round(), but at this point I would have to review all the calculations of the entire program

@effedib
Copy link

effedib commented May 26, 2025

Good job

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