PRP201c_-_PE1_-_SP_2024_1903.webp
Riza85

PRP201c_-_PE1_-_SP_2024_1903.webp

  • Media owner Riza85
  • Ngày thêm
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
Chưa có bình luận nào.

Thông tin

Category
PRP201c
Thêm bởi
Riza85
Ngày thêm
Lượt xem
961
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRP201c_-_PE1_-_SP_2024_1903.webp
File size
195.7 KB
Dimensions
1920px x 991px

Share this media

Back
Bên trên Bottom