Registry Synced

jan-2026-python-week-8-grpa-1

371 words
2 min read

GrPA 1

Course: Jan 2026 - Python
GrPA 1
Due Apr 08, 2026 at 11:59 PM IST
Instructions
Use "Test Run" to verify your code with public test cases.
Press "Submit" to have your assignment evaluated.
You can submit your assignment multiple times up until the deadline.
Make sure to submit your final code by the deadline to receive your score.
Summary
- out of100
Score
Public Tests
0/0 Passed
Private Tests
0/0 Passed

**Change in eligibility criteria to write oppe2 exam: A5>=40/100 AND A6>=40/100 AND A7>=40/100 AND A8>=40/100. and becoming eligible to give the end term exam. ** filename is a text file that contains a collection of words in lower case, one word on each line. Write a function named get_freq that accepts filename as argument. It should return a dictionary where the keys are distinct words in the file, the values are the frequencies of these words in the file.
For example, given the following file:
good
great
good
work
work
The dictionary returned should be:
{'good': 2, 'great': 1, 'work': 2}
The order in which the words are added to the dictionary doesn't matter.

(1) filename is a string variable that holds the name of the file. For example, in the first test case, it is filename = 'public_1.txt'.
(2) You do not have to accept input from the console or print the output to the console. You just have to write the function definition.

Public Tests ( 0/0 )

Case 1

Input:
text
100
public_1.txt

Case 1

Expected Output:
text
an:6
correct:2
ideal:7
inner:5
something:2

Case 2

Input:
text
200
public_2.txt

Case 2

Expected Output:
text
good:2
great:3
inner:2
precise:2
something:7

🔒 Private Tests ( 0/0 )

This test case group is locked and will be revealed after the deadline.


💻 IITM Official Solution

Solution code is currently locked and will be available after the deadline.

💻 My Submitted Code

python
def get_freq(filename):
    """
    Extract frequency information from the file

    Argument:
        filename: string, path to file
    Return:
        result: dictionary; keys are strings, values are integers
    """

Document Outline
Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.