4. You are exploring the punctuation at the end of sentences and want to split sentences so that each word is
separate and any punctuation is included in the word next to it. Complete the parse_sentences function to
accomplish this task.
1 import re
2 def parse_sentences(sentence):
3 pattern = r'\w+\.|[\^\w\s]' #enter the regex pattern here
4 result = re.findall(pattern, sentence) #enter the re method here
5 return result
6
7 print(parse_sentences("Hello! How are you doing?")) # should return ['Hello!', 'How',
8 print(parse_sentences("what a beautiful day it is")) # should return ['whatabea
9 print(parse_sentences("2 + 2 is definitely 4!")) # should return ['2', '+', '2 Run' is
10
Incorrect
Reset