Understanding Strings as Sequences
Both representations preserve sequence order, but they do not represent the sequence in the same structural form.
One Sequence, Different Structures
A string is a sequence of text characters. A list of characters is also a sequence, but it is a different kind of structure. The difference matters because your goal determines how the text should be represented: use list() when you need individual characters, split() when you need words or larger segments, and join() when you need to build one string from several string elements.
Both representations preserve sequence order, but they do not represent the sequence in the same structural form.
Mapping Characters with list()
Call list() with a string when the desired result is one list element for each individual character. The characters remain in their original sequence order, so the first character occupies the first list position, the second character occupies the second position, and so on.
['h', 'e', 'l', 'l', 'o']Splitting Words and Segments
Use the split() method when the desired result is a list of words or larger segments. A delimiter identifies where one segment ends and the next begins. The delimiter may be supplied to split() so the string is divided at that chosen boundary.
['red', 'green', 'blue']Choosing a Segment Boundary
Turn the text "2026-09-27" into separate segments using the hyphen as the delimiter.
- 1Identify the boundary
The hyphen separates the larger pieces of text.
- 2Apply split()
Use the hyphen as the delimiter passed to
split(). - 3Read the result
The result is a list containing the segments on either side of each hyphen.
['2026', '09', '27']
Rebuilding Text with join()
Use join() to combine a list of strings into one string. The separator is the string on which join() is called, and that separator is placed between the list elements as they are combined.
red, green, blueSelecting the Right Conversion
Choose the operation by asking what each resulting element should represent. If an element should represent one character, use list(). If an element should represent a word or segment separated by a delimiter, use split(). If you already have string elements and want one finished string, use join().
| Processing goal | Operation | Result structure |
|---|---|---|
| Work with individual characters | list(string) | A list of character elements |
| Separate words or segments | string.split(delimiter) | A list of text segments |
| Build one string from string elements | separator.join(list_of_strings) | One combined string |
Match the operation to the structure you need.
Mistakes Beginners Make
Common mistake Using list() when the goal is to separate words or segments
What it looks likelist("red,green,blue")Why it failslist()produces individual characters, including the commas, rather than larger segments.Do this insteadUse "red,green,blue".split(",") when commas define the segment boundaries.
Common mistake Using split() when the goal is to obtain individual characters
What it looks like"hello".split()Why it failssplit()is intended to break text into words or segments, not to express the character-by-character conversion.Do this insteadUse list("hello") for a list of individual characters.
Common mistake Calling join() on the list
What it looks like["red", "green"].join(",")Why it failsjoin()is called on the separator string, not on the list.Do this insteadWrite ",".join(["red", "green"]).Common mistake Forgetting that the separator controls the rebuilt text
What it looks like"".join(["red", "green"])Why it failsAn empty separator places nothing between the elements.
Do this insteadChoose the separator that matches the desired output, such as ", " or " ".
["red", "green"].join(",")The list is treated as if it owns join().
",".join(["red", "green"])The separator string calls join() and receives the list.
Practice the Choice
For each goal, choose list(), split(), or join(): obtain each character from "code"; separate "one|two|three" at the vertical bar; combine ["one", "two", "three"] with a single space between elements.
Hints
- Ask whether the desired elements are characters, larger segments, or an already existing list of strings.
- For
join(), remember that the separator appears before .join().
Checking the Three Goals
Select the operation for each of the three text-processing tasks.
- 1Characters
The target elements are individual characters, so use
list("code"). - 2Segments
The vertical bar marks the boundaries between segments, so use "one|two|three".split("|").
- 3Rebuilt text
The input is already a list of strings, and a space must be placed between elements, so use " ".join(["one", "two", "three"]).
list("code") produces ['c', 'o', 'd', 'e']; splitting produces ['one', 'two', 'three']; joining with a space produces "one two three".
Key Takeaways
- 1A string and a list of characters are both sequences, but they are different structures.
- 2Use
list()to convert a string into individual character elements. - 3Use
split()to divide a string into words or segments at a delimiter. - 4Use
join()to combine a list of strings, with the separator placed between elements. - 5Remember that
join()is called on the separator string, not on the list.
At a glance
- Use
list()for character-level conversion. - Use
split()when delimiters should divide text into words or segments. - Use
join()to rebuild one string from a list of strings. - Choose the operation according to the structure your next processing step requires.
- Call
join()on the separator string.