Hello!
Today's question is this!
Create a function that takes a
word
and extends all vowels by a numbernum
.
Write a function that finds the longest word in a sentence. If two or more words are found, return the first longest word. Characters such as apostophe, comma, period (and the like) count as part of the word (e.g. O'Connor is 8 characters long).
Examples
longest_word("Margaret's toy is a pretty doll.") ➞ "Margaret's" longest_word("A thing of beauty is a joy forever.") ➞ "forever." longest_word("Forgetfulness is by all means powerless!") ➞ "Forgetfulness"
OK!
This is my solved code!
Let's split the word!
Then, let's make a new string and loop.
We will check if the length of the string is smaller than the word's length.
Then, we will change the string to the word.
Lastly, we will return the string.
Easy!
Bye!!!
0 件のコメント:
コメントを投稿