Q28Single correct4 Marks11 Dec 2022
careers.csv is a file that has the details of the careers of some cricketers. The first column is the name of the player, the second column is the year in which the player made his first appearance in international cricket and the third column is the year in which the player retired. The entire file is given below for your reference.
Player,Start,End
Tendulkar,1989,2013
Ponting,1995,2012
Kallis,1995,2013
Dravid,1996,2012
Cook,2006,2018
Sangakkara,2000,2015
Lara,1990,2008
Chanderpaul,1994,2015
Jayawardene,1997,2014
Border,1978,1994
Waugh,1985,2004
Gavaskar,1971,1987
Khan,2000,2017
Amla,2004,2019
Root,2012,2021
A player is said to be active from his start year to end year, endpoints inclusive. For example, Tendulkar was active for 2013 - 1989 + 1 = 25 years.
Create a list of tuples named careers that has the following form:
[
('Tendulkar', 1989, 2013),
('Ponting', 1995, 2012),
... # Fill the remaining entries
('Root', 2012, 2021)
]
Each entry in the list is a tuple that corresponds to one line in the file. The header has to be ignored. The type of each element within a tuple should be (str, int, int). Which of the options corresponds to the correct implementation?