Computer Science - Class 12
Chapter 14 - Functions in python

What will be the output of the following code?

L = ['a','b','c','d']

print ("".join(L))

(a) Error

(b) a b c d

(c) [‘a’,’b’,’c’,’d’]

(d) None

 

Answer:

The join( ) function joins all items in a list or tuple into a single string.

So, the output of the given code will be ‘ abcd’.

So, the correct answer is (b).

Ask a doubt
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.