- format() is one of the string formatting methods in Python,that allows multiple substitutions and value formatting. This method lets us concatenate elements within a string through positional formatting.
Syntax-
str.format(value)
Example-
string is str='{} is a programming language'
then str.format("Python") will return "Python is a programming language"
and str.format("Java") will return "Java is a programming language"
program-
s="{} is a programming"
print(s.format("Python"))
print(s.format("Python"))
s="Avenger is {}"
print(s.format("Awesome"))
print(s.format("Great"))
s='Text is {} the boundary'
print(s.format("between"))
Python is a programming
Python is a programming
Avenger is Awesome
Avenger is Great
Text is between the boundary