kord
answered Jun 29 '23 00:00
{0} is used with the format() method to put values into a string dynamically.
for example
adjective= "language"
totalmethod = 25
message = "Python is good {0} , which have {1} methods ".format(name, totalmethod )
print(message)
will output like this
Python is good language , which have 25 methods
here {0} and {1} is work as placeholder for corresponding variable passed in format method
you can use any number of placeholder with same number of corresponding variable at format method.