what is the use of string formatting in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is the use of string formatting in python

8th May 2020, 12:43 PM
srinu
srinu - avatar
3 Answers
+ 2
Easier to read code a = 24 b = 'dragons' print('There are ' + str(a) + b) print(f'There are {a} {b}') both print statements print the same thing. One is way easier to read
8th May 2020, 12:48 PM
Slick
Slick - avatar
+ 1
Its primary use is for substitution and assignments
8th May 2020, 12:48 PM
James Clark I. Vinarao
James Clark I. Vinarao - avatar