Question: This is for an intro to Python class: Write a function called split_into_letters that has a string as a parameter. That string contains a sentence.
This is for an intro to Python class:
Write a function called split_into_letters that has a string as a parameter. That string contains a sentence. You should return a list of lists. Each inner list corresponds to a word. Each item in that inner list is one of the letters in that word.
Say you call the function like this:
print(split_into_letters('How are you today?')) This should output:
[['H', 'o', 'w'], ['a', 'r', 'e'], ['y', 'o', 'u'], ['t', 'o', 'd', 'a', 'y', '?']]
HINT: You can use the list function to get a list of letters from an individual word, like this:
list_of_letters = list(word)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
