Skip to content

Commit

Permalink
change display of floats #21 #22
Browse files Browse the repository at this point in the history
  • Loading branch information
blahosyl committed Apr 14, 2024
1 parent bead437 commit 703e0e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,6 @@ The following resources were used to learn/double check general, atomic function
- [naming conventions](https://peps.python.org/pep-0008/)
- [naming global vs. local variables](https://stackoverflow.com/questions/69193413/why-does-the-python-style-guide-suggest-the-same-style-for-both-global-and-local)
- [conventions for putting modules into separate files](https://stackoverflow.com/questions/2864366/are-classes-in-python-in-different-files)
- [classes of the same module can be grouped in the same file](https://softwareengineering.stackexchange.com/a/306492)
- [classes of the same module can be grouped in the same file](https://softwareengineering.stackexchange.com/a/306492)
- [print floats in general notation - only print decimal point and decimal place digits if they are "not empty"](https://stackoverflow.com/a/2440708/24248624)
- [string operations](https://docs.python.org/3/library/string.html#format-specification-mini-language)
2 changes: 1 addition & 1 deletion planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def print_formatted(self, ingredient_list):
# the quantity (second item of the list)
print_string = print_string[:opening - 1] \
+ ': ' \
+ str(ingredient_list[i][1]) \
+ f"{ingredient_list[i][1]:g}" \
+ print_string[opening - 1:]
print_string = print_string.replace('(', '')
print_string = print_string.replace(')', '')
Expand Down

0 comments on commit 703e0e4

Please sign in to comment.