Python Practice › String Programs › Program 19

Build a sentence from a list of words

EasyString Programs · 19 of 106

Write a Python program to create a string from a list of words.

Advertisement
Input
["There", "are", "Many", "Programming", "Language"]
Output
There are Many Programming Language

Approach

  1. " ".join(words).

Solution

Python
words = ["There", "are", "Many", "Programming", "Language"]print(" ".join(words))
Output
There are Many Programming Language

Line by line

Line 2

join puts the separator (a space) between the words.

Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More string programs

← All 106 String Programs