REFERENCE TIMESTAMP : 1:59:30
word_count1=dict()
line1=input(‘Enter the text:’) #user_input
words1=line1.split()
for word1 in words1:
word_count1[word1]=word_count1.get(word1,0)+1
bigcount is None
bigword is None
for word1,count in word_count1.items():
if count>bigcount:
bigword=word1
bigcount=count
print(bigword,bigcount)
OUTPUT:
Enter the text: this is a line of this text
text 7
Shouldn’t the output be,
this 2
since ‘this’ is appearing 2 times in the text entered, which is the most no of times?Or am I missing something?
Thanks.