Question: I will walk you through the steps: 1 . Write a program to read through the agreed - hours.txt file and determine the distribution of

I will walk you through the steps:
1.Write a program to read through the agreed-hours.txt file and determine the distribution of Agreed Hours for all courses prefixed with ICT. The file short-agreed-hours.txt should not be used in the submission, but you may investigate this file to understand the problem better. Your program must include the following:
2. All rows starting with ICT that have agreed hours, should be included, for example:
CHCRH503A C90 # should not be included as it does not start with ICT.
ICTCBL201 C50 # has 50 agreed hours which should be included.
ICTCBL2012A C # has no agreed hours and should not be included.
3. You can split strings starting with ICT, by tabs (\t).
Tip:
To split code using tabs:
possible = possible.split(\t)
4. Accumulate the number of records with the same Agreed Hours
5. Sort and print each count by frequency.
6. Print the total of the number of records.
7. The order of the records printed, with the same frequency, may vary from the example below.
8. Ensure you have relevant comments in your code to enhance maintainability.
Extract of output for agreed-hours.txt:
hours: 60 frequency: 480
hours: 40 frequency: 430
hours: 50 frequency: 246
hours: 30 frequency: 216
hours: 20 frequency: 170
hours: 80 frequency: 162
hours: 150 frequency: 91
hours: 45 frequency: 33
hours: 70 frequency: 25
hours: 10 frequency: 18
hours: 35 frequency: 17
hours: 120 frequency: 12
PYTHON CODE -DONT USE CHATGPT OR ANY AI. PLEASE INCLUDE COMMENTS ON CODE.
Example: Desired output for short-agreed-hours.txt file:
hours: 50 frequency: 4
hours: 30 frequency: 4
hours: 40 frequency: 3
hours: 45 frequency: 2
hours: 60 frequency: 1
hours: 36 frequency: 1
TOTAL NUMBER OF RECORDS: 6

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!