1. Home
  2. Data Science
  3. Python
  4. What is the result of '-'.join(['a', 'b', 'c'])?

Added 2 Nov 2026

What is the result of '-'.join(['a', 'b', 'c'])?

  1. '-a-b-c-'
  2. ['a-b-c']
  3. 'abc-'
  4. 'a-b-c' Correct answer

Correct answer

D. 'a-b-c'

17 views

MCQSEXAM

Explanation

str.join() places the separator between items of an iterable of strings. It is much faster than repeated + concatenation in a loop.

Reference

Asked in: NTS, PPSC, Python Developer Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs