Question: Given a sentence, as input with special characters in it, the output should be the number of times a word is repeated. Note: The digits
Given a sentence, as input with special characters in it, the output should be the number of times a word is repeated.
Note: The digits are not permitted, the special characters should be only occur at the end appropriately.
Eg:
Shall we go for a walk? valid statement
Shall? We go for a walk invalid statement
'People skills are in demand! Your people skills are bankable assets.' The output should be
{ 'are': 2,
'assets': 1,
'bankable': 1,
'demand': 1,
'in': 1,
'people: 2,
'skills': 2,
'your': 1}
Write a python program to count the number of words in a given sentence, where all the above constraints are applied.
[Hint: use pprint function for printing dictionary in sorted order.
Syntax for pprint is pprint(dictionary name)
Include the line from pprint import pprint in the top of your program]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
