Lowest price ever! Learn Generative AI for 48% less!
Get my discount+ 1
what is the use of string formatting in python
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
+ 1
Its primary use is for substitution and assignments