- 3
What is the result of this code? print ("{0}{1}{0}.format ("abra" ,"cad"))
string formatting
10 Antworten
+ 6
u got some Syntax errors.
anyway.
{0} => "abra"
{1} => "cad"
print ("{0}{1}{0}".format ("abra" ,"cad"))
output: abracadabra
+ 4
What is the result of this code?
print("{0}{1}{0}".format("abra", "cad"))
abracadabra
since {0} = abra
{1} = cad
{0} = abra
so answer is abracadabra
+ 1
ans:abracadabra
0
What is the output of this code?
def test(func, arg):
return func(func(arg))
def mult(x):
return x * x
print(test(mult, 2))
0
What is the result of this code?
print("{0}{1}{0}".format("abra", "cad"))
print 0 will print the argument abra
and 1 will print the argument cad
hence, abra{0}cad{1}again abra{0}
ans:abracadabra
0
Abracadabra
0
>>> abracadabra
0
What is the result of this code?
print("{0}{1}{0}".format("abra", "cad"))
index 0 Index 1 Index 0
abra cad abra
Ans: abracadabra
0
abracadabra
0
What's the result of this code?
print("{0}{1}{0}".format("abra", "cad"))
Answer is abracadabra