+ 1
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]
1 ответ
+ 2
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]