Test Index

CBSE Class 12 Computer Science 2024 Paper Compartment Get it on Google PlayDownload on the App Store

© examsnet.com
Question : 32 of 35
Marks: +1, -0
Mr. Mahesh is a Python Programmer working in a school. He has to maintain the records of the sports students. He has created a csv file named sports.csv, to store the details. The structure of sports.csv is :
[sport_id, competition, prize_won]
where
sport_id, is Sport id (integer)
competition is competition name (string)
prize_won is (“Gold”, “Silver”, “Bronze”)
Mr. Mahesh wants to write the following user-defined functions :
Add_detail(): to accept the detail of a student and add to a csv file, "sports.csv".
Count_Medal(): to display the name of competitions in which students have won "Gold" medal.
Help him in writing the code of both the functions.
Advertisements
Go to Question: