Foundations-of-Applied-Mathematics / Labs

Labs for the Foundations of Applied Mathematics curriculum.
https://foundations-of-applied-mathematics.github.io/
211 stars 71 forks source link

Exceptions and File IO - pdf #19

Closed cnoorda2 closed 2 years ago

cnoorda2 commented 2 years ago

It has come to my attention that the Exceptions and File IO lab has a section on string manipulation. It mentions format strings, but never mentions f strings. These are a more readable, more concise, and less prone to error than other ways of formatting, and they are also faster.

Example: In the third-to-last code block of the lab, you have the following code: print("Is today {} {}, {}?".format(day, month, year)) Which could be simplified to the following using an f-string: print(f"Is today {day} {month}, {year}?")

ADD F STRINGS WHERE NEEDED!!!