What would be the result of the following code: '{0}{1}{0}'.format(1, 0)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What would be the result of the following code: '{0}{1}{0}'.format(1, 0)?

0. '010' 1. '100' 2. '101' 3. '01{0}'

23rd Jul 2020, 10:29 AM
Abhijeet Bhati
Abhijeet Bhati - avatar
5 Answers
+ 3
you can ask why the output would be this and then we can maybe discuss it but asking for the output doesn't really make sense, you can try executing the code to get the result
23rd Jul 2020, 10:33 AM
Bagon
Bagon - avatar
+ 2
You can also try it yourself. If you want, you can ask the question that "How the output of this code is ....." So, let me tell you hints: The output will be " 101"(According to me) because inside format, 1 and 0 are given and the indexing values for replacing are 0,1,0. In the place of 0 index,1 is given and in the place of index 1 index,0 is given and in the place of index 0, 1 is again given Edit: Yeah, I was right. I just checked up in the code playground.
23rd Jul 2020, 10:36 AM
Arctic Fox
Arctic Fox - avatar
+ 1
pop it in the playground and see!
23rd Jul 2020, 10:30 AM
Slick
Slick - avatar
+ 1
101 Do you want to know the reason?
23rd Jul 2020, 12:01 PM
Namit Jain
Namit Jain - avatar
0
What is this ? 1.100. Here MCQ .
23rd Jul 2020, 1:42 PM
shubham kumar
shubham kumar - avatar