Question #329359

word count problem:

input: hello world welcome to python world

output:

hello: 1

world: 2

welcome: 1

to: 1

python: 1


Expert's answer

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!

LATEST TUTORIALS
APPROVED BY CLIENTS