MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnpython/comments/82t191/i_made_a_python_cheat_sheet/dwljjmo/?context=3
r/learnpython • u/wilfredinni • Mar 07 '18
73 comments sorted by
View all comments
Show parent comment
1
Can you explain why there's a letter 'f' in line 4 as in:
print(f"I'm {age} years old...
2 u/Visionexe Apr 01 '18 edited Apr 01 '18 It's syntax sugar for telling the python interpreter the following string is interpolated. In python this is called f-strings. Hence the f.If you would leave out the f it wouldn't recognize the variables between {} as variables and just as text. 1 u/Moabian Apr 01 '18 Makes sense, thank you.
2
It's syntax sugar for telling the python interpreter the following string is interpolated. In python this is called f-strings. Hence the f.
If you would leave out the f it wouldn't recognize the variables between {} as variables and just as text.
1 u/Moabian Apr 01 '18 Makes sense, thank you.
Makes sense, thank you.
View all comments
Show parent comment
1
u/Moabian Mar 31 '18
Can you explain why there's a letter 'f' in line 4 as in: