+ 2
What does that this function signifies?...Can you please make me understand?
print ("{0}{1}{0}".format('abra','cad'))
5 odpowiedzi
+ 2
Its replacing the placeholders {...}.
{0} = first item
{1} = second item
So "abra" + "cad" + "abra"
+ 3
{0} equals first argument passed into the format function
{1} equals second argument passed into the format function
{2} equals third argument passed into the format function
And so on...
So output would be
abracadabra
It's also the same as:
print(f"{'abra'}{'cad'}{'abra'}")
+ 3
{0}{1}{0}={abra}{cad}{abra}
0
What??