current position:Home>Python code programs don't

Python code programs don't

2022-02-03 00:38:31 CSDN Q & A

Programming input a paragraph of English , Count the number of words in English , And output the result .




Refer to the answer 1:
mydict={}for i in input(" English sentences ").split():    if i in mydict:        mydict[i]+=1    else :        mydict[i]=1for  key,value in mydict.items():    print(key,value)

English sentences I lied when I said I didn’t like you. I lied when I said I didn’t care. I lie every time I try to tell myself I will never fall for you.
I 9
lied 2
when 2
said 2
didn’t 2
like 1
you. 2
care. 1
lie 1
every 1
time 1
try 1
to 1
tell 1
myself 1
will 1
never 1
fall 1
for 1




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202030038299286.html

Random recommended