0
f"python str {var}" doesn't work
var = "str" print(f"this is a {var}") gives a syntax error . How to use the f"{}" string formatting ?
3 Answers
+ 7
f-string is new in Python 3.6. Unfortunately, SoloLearn is still using Python 3.5.
This works:
var = "str"
print("this is a {}".format(var))
https://www.python.org/dev/peps/pep-0498/
0
did you get?
0
The problem was with the Python version