Sentences are better

Report a typo

Paul has written a program which splits a paragraph into sentences and prints the result. However, it doesn't work properly. Fix the code below to make it work. Keep in mind that there shouldn't be any punctuation signs in the end of the output sentences.

Sample Input 1:

He hid under the covers hoping that nobody would notice him there. It really didn't make much sense since it would be obvious to anyone who walked into the room there was someone hiding there, but he still held out hope. He heard footsteps coming down the hall and stop in front in front of the bedroom door. He heard the squeak of the door hinges and someone opened the bedroom door. He held his breath waiting for whoever was about to discover him, but they never did.

Sample Output 1:

He hid under the covers hoping that nobody would notice him there
It really didn't make much sense since it would be obvious to anyone who walked into the room there was someone hiding there, but he still held out hope
He heard footsteps coming down the hall and stop in front in front of the bedroom door
He heard the squeak of the door hinges and someone opened the bedroom door
He held his breath waiting for whoever was about to discover him, but they never did
Write a program in Python 3
import re
string = input()

pattern = r"\s+"
x = re.match(string, pattern)

print(x)
___

Create a free account to access the full topic