+ 2
F string not work in codeplayground but why?
x=('abc') print(f'my name is {x}') but it give error.but f string present in Python 3.why it execute error.
2 Answers
+ 8
Andrey Vostokov Almost correct. You need the f before the string.
https://cito.github.io/blog/f-strings/
0
@Jan Markus, so basically the following two examples are executed identically?
sl = 'SoloLearn'
print('I love {}!'.format(sl))
&
sl = 'SoloLearn'
print('I love {sl}!')