Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use f-strings #1020

Open
airalcorn2 opened this issue Nov 1, 2022 · 1 comment
Open

Use f-strings #1020

airalcorn2 opened this issue Nov 1, 2022 · 1 comment

Comments

@airalcorn2
Copy link

airalcorn2 commented Nov 1, 2022

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.

@tintin554
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants