-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: main
Are you sure you want to change the base?
Solution/final project #103
Conversation
.DS_Store
Outdated
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Good job |
Propongo la mia risoluzione di questo progetto