repl.it
@RoselyAlvaradoV/

how many times

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
count = dict()
sente= input("Enter a line of text: ") #prompt for user to input a sentence 
words = sente.split() #splits all lines to words 
for word in words: 
  #for every word in words counts the number of times the word appears 
  count[word] = count.get(word,0) + 1
print('Counts', count)