निम्नलिखित कोड का परिणाम क्या है:
What is the output of the following code:
L=[‘a’,’b’,’c’,’d’]
print ( “”.join(L)) A
Error
B
None
C
abcd
D
[‘a’,’b’,’c’,’d’]
Explanation
The code snippet:
L = ['a', 'b', 'c', 'd']
print("".join(L))
- The
join()method is used to join elements of a list into a single string. - The
""before.join(L)means that there will be no separator between the elements of the list. - It will join the elements
'a','b','c', and'd'into the string"abcd".
So, the output is:
(C) abcd.
Correct Answer: C) abcd