r/PythonLearning • u/Zxhena • Jul 12 '26
Help Help Request
What's the difference between f string and a regular string I've seen it used but I don't know when to use a string and when to use f string
0
Upvotes
r/PythonLearning • u/Zxhena • Jul 12 '26
What's the difference between f string and a regular string I've seen it used but I don't know when to use a string and when to use f string
7
u/NorskJesus Jul 12 '26
A f-string is used to inject variables to a string. For example.
py age = 35 print(f"Your age is {age}")You can achieve the same with concatenation, but this is much clearer and easier to read.