What will be the output of the following code : L=['a','b','c','d'] print "".join(l)
Answers
Answered by
2
Output:
abcd
Explanation:
- Join is a in built function in python.
- The join() function is used to join elements of sequence or strings using str separator.
- The join() function takes all the items in a iterable and joins them into single string.
- Syntax: str.join(iterable or list or tuple etc)
Program:
L=['a','b','c','d']
print ("".join(L))
Let us understand the program.
L=['a','b','c','d'] # This is a list of elements with a character.
# Now, join function joins elements of list L by '' sting L.
print ("".join(L)) #This statement is used to print the value of L after joining the characters.
Refer the attached image for the output.
Attachments:
Similar questions
Math,
3 months ago
English,
3 months ago
India Languages,
8 months ago
Computer Science,
8 months ago
Math,
11 months ago
Math,
11 months ago
Science,
11 months ago