How to Create a List of Letters in a Word Using Python?

Estimated read time 1 min read

You can create a list of letters in a word using Python by converting the word into a list of characters. Here’s an example:

word = "Python"
letters = list(word)


['P', 'y', 't', 'h', 'o', 'n']

In this example, we first define a variable word which contains the string “Python”. Then we convert the word into a list of characters by calling the list() function on the string. This creates a new list containing each character in the string as a separate element.

Finally, we print the letters list, which contains the letters of the word “Python”.

You May Also Like

More From Author

+ There are no comments

Add yours

Leave a Reply