diff --git a/README.md b/README.md index 4e60854..69cf9e2 100644 --- a/README.md +++ b/README.md @@ -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) \ No newline at end of file +- [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) \ No newline at end of file diff --git a/planner.py b/planner.py index 3ba267e..79e07a1 100644 --- a/planner.py +++ b/planner.py @@ -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(')', '')