Answer to Question #329359 in Python for praveen singh

Question #329359

word count problem:

input: hello world welcome to python world

output:

hello: 1

world: 2

welcome: 1

to: 1

python: 1


1
Expert's answer
2022-04-16T09:02:38-0400
input = "hello world welcome to python world"

for i in set(input.split(" ")):
	print(f"{i}: {input.count(i)}")

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