Skip to content

Solution/final project#103

Open
Danielef12 wants to merge 4 commits into
tomorrowdevs-projects:mainfrom
Danielef12:solution/final-project
Open

Solution/final project#103
Danielef12 wants to merge 4 commits into
tomorrowdevs-projects:mainfrom
Danielef12:solution/final-project

Conversation

@Danielef12

Copy link
Copy Markdown

Propongo la mia risoluzione di questo progetto

Comment thread .DS_Store

Copy link
Copy Markdown

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")

@effedib effedib May 25, 2025

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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

effedib commented May 26, 2025

Copy link
Copy Markdown

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