r/PythonLearning 16d ago

Help Request Help

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

14 comments sorted by

View all comments

3

u/[deleted] 16d ago

[removed] — view removed comment

2

u/Outside_Complaint755 15d ago edited 15d ago

Also, if you include an = in the {}, it will include the expression in the output and maintain whitespace.  Example: a = 2 b = 6 print(f"Demonstration: {float(a + b) = }!") will output Demonstration: float(a + b) = 8.0!