Answer to Question #233976 in Python for Lovely

Question #233976
How can i remove the spaces in output please provide me the proprler answer
Word Count - 2

Given a sentence S, write a program to print the frequency of each word in S, where words are sorted in alphabetical order.

Input

The input will be a single line containing a string S.
1
Expert's answer
2021-09-08T16:10:37-0400
n = input('Enter string here: ')
n_list = n.split(' ')
unique_list = sorted(set(n_list))
for i in unique_list:
    print(i, n_list.count(i))

Enter string here: i am a boy am
a 1
am 2
boy 1
i 1

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS