PRP201c_-_PE1_-_SP_2024_1903.webp
Riza85

PRP201c_-_PE1_-_SP_2024_1903.webp

  • Media owner Riza85
  • Ngày thêm
Practical exam 02: PRP201c
120 minutes
Exercise 1: (3 marks)
Write a program that ask the user how many integers they want to generate. It should then generate that many integers randomly which is range from 1 to 100 and then store them in a list.
After the list is populated, the program will calculate and display the average of these numbers, and also display the smallest and highest value in the list.
Result of the program:
How many random integers would you like to generate? -5
Please enter a positive integer.
How many random integers would you like to generate? a
Invalid input. Please enter a positive integer.
How many random integers would you like to generate? 5
Generated list of integers: [60, 3, 66, 49, 62]
Average of the numbers: 48.00
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
+ 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
1,164
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
244.9 KB
Dimensions
1920px x 991px

Share this media

Back
Bên trên Bottom