Smallest number: 3
Largest number: 66
Exercise 2: (3 marks)
Write a program named count_word_occurrences that reads a text file named 'data_2.txt'. The program counts the occurrence of each unique word, then displays the number of occurrences of each word, and the word with the highest frequency.
The content of data 2.txt file:
The quick brown fox jumps over the lazy dog.The dog was not lazy, but rather energetic.Foxes are quick and the dog is clever.
Result:
the: 4, quick: 2, brown: 1, fox: 1, jumps: 1, over: 1, lazy: 2, dog: 3, was: 1,not: 1, but: 1, rather: 1, energetic: 1, foxes: 1, are: 1, and 1, is: 1, clever:1
The word with the most frequency is 'the' which appears 4 times.
Exercise 3: (4 marks) Write a program that implement following tasks:
+ 100%
Zoom
Close