Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

p15.

py
# 15.NUMBER OF WORDS

k=input("enter the sentence")


s=k.split()
x=""
d={}
for i in s:
p=i.strip(".,?/")
x+=(p+" ")
for a in x.lower().split() :
if i not in d :
d[a]=x.lower().split().count(a)
for k in d:
print(k,d[k])

Page 1

You might also like