Guess the output: | SoloLearn: Learn to code for FREE!


Guess the output:

Guess the output: x=[[0],[1]] print((''.join(list(map(str,x))))) A. ('[0][1]') B. ('01') C. 01 D. [0][1]

4/28/2020 5:26:07 PM

Darshaan Aghicha

1 Answer

New Answer


You can not only guess the output but also check it in the code playground by running the code. Output will be D [0][1] map(str,x) converts each item of the list x (which is [[0],[1]]) to a string. list() creates list from that elements. result of executing list(map(str,x)) is a new list with two string elements: ['[0]', '[1]'] ''.join(['[0]', '[1]']) creates a new string by joining all elements of the list using empty string as separator, so output will be [0][1]