python-novice-inflammation
python-novice-inflammation copied to clipboard
Use f-strings
I think the lesson would benefit from switching to f-strings for print statements. E.g., the line here:
print('weight in pounds:', 2.2 * weight_kg)
would become:
print(f'weight in pounds: {2.2 * weight_kg}')
f-strings are typically more readable and easier to work with than other printing options.
I agree that they are more readable. Might it be best to demonstrate all ways of formatting a string and highlighting the pros and cons of each method? I'm thinking that if a learner comes across some code using one of the older formatting methods they might not understand what that method is doing.