Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
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

Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,5 @@ Cargo.lock
# End of https://www.toptal.com/developers/gitignore/api/node,go,java,intellij,visualstudiocode,haskell,erlang,elixir,rust
/.vs/ProjectSettings.json
/.vs/slnx.sqlite
.DS_Store

12 changes: 6 additions & 6 deletions projects/final-project/solution/danieleFiocca/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,16 @@
dinner_fat = (foods["salmon"][3] * qty_salmon / 100) + (foods["quinoa"][3] * qty_quinoa / 100) + (foods["spinach"][3] * qty_spinach / 100) + (foods["olive oil"][3] * qty_oil / 100)
print(f"Total Dinner macros: protein {dinner_protein:.0f}g | carbs {dinner_carbs:.0f}g | fat {dinner_fat:.0f}g\n")

total_protein_day = breakfast_protein + snak_protein + lunch_protein + dinner_protein
total_carbs_day = breakfast_carbs +snak_carbs + lunch_carbs + dinner_carbs
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


print("-" * 60)
print(f"The amount of macronutrients for the day is: ")
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")
print(f"\n- Protein: {total_protein_day}g")
print(f"- Carbs: {total_carbs_day}g")
print(f"- Fat: {total_fat_day}g\n\n")


print("*" * 60)
Expand Down