How to Join List of Words into a Sentence in Python

Concatenate a list of strings into a single sentence with spaces using the Python string join() method.

Easy Python 3.9+ Aug 9, 2026 Strings & text 15 views 0 copies

Python code

3 lines
Python 3.9+
words = ["Hello", "world", "this", "is", "Python"]
sentence = " ".join(words)
print(sentence)

Output

stdout
Hello world this is Python

How it works

The str.join() method takes an iterable of strings and concatenates them with the string it is called on as the separator. Here, we call " ".join(words) to join the list with a space. This approach is efficient and idiomatic compared to using a loop with string concatenation, because it avoids creating multiple intermediate strings. The method works with any iterable of strings, including lists, tuples, and generators, as long as all elements are strings.

Common mistakes

  • Calling `words.join(" ")` instead of `" ".join(words)` — join is a string method, not a list method.
  • Trying to join a list containing non-string items (e.g., numbers) without converting them to strings first.
  • Using `+` in a loop, which is slower and less readable for joining many strings.

Variations

  1. Use `', '.join(words)` to join with commas instead of spaces.
  2. Convert non-strings with `" ".join(map(str, words))`.
  3. Join with no separator: `''.join(words)`.

Real-world use cases

  • Building a readable error message from a list of validation issues.
  • Creating a single search query string from a list of keywords.
  • Formatting a list of names into a greeting message for an email or UI.

Sponsored

Run this sample

Open the browser IDE to tweak the example and see results without installing anything.

Open editor

More from Strings & text

Related tutorials and quizzes for this topic.