Registry Synced

jan-2026-python-week-8-grpa-3

420 words
2 min read

GrPA 3

Course: Jan 2026 - Python
GrPA 3
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 CSV file that has the following header:
Name,Country,Goals
The first five lines of a sample file are given below:
Name,Country,Goals
P1,Brazil,20
P2,Argentina,30
P3,Brazil,50
P4,Germany,30
Write a function named get_goals that accepts filename and the name of a country as arguments. It should return a tuple having two elements: (num_players, num_goals). num_players is the number of players from this country that appear in this file, num_goals is the total number of goals scored by all the players who belong to this country. If the country is not present in the file, then return the tuple (-1, -1).

(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.csv'.
(2) Each player who represents a country has scored at least one goal. That is, the last column in the file will have only positive integers.
(3) You do not have to accept input from the user 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.csv
Brazil

Case 1

Expected Output:
text
4,105

Case 2

Input:
text
200
public_2.csv
Spain

Case 2

Expected Output:
text
8,161

Case 3

Input:
text
300
public_3.csv
Random

Case 3

Expected Output:
text
-1,-1

🔒 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_goals(filename, country):
    """
    Get the count of players and their cumulative goals for this country

    Arguments:
        filename: string
        country: string
    Return:
        result: tuple, (integer, integer)
    """

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.