Check sibling questions

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).

  1. Computer Science - Class 12
  2. Chapter 14 - Functions in python

About the Author

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 and Computer Science at Teachoo