Question: Write a function that playerHasLastInitial(filename, char) that takes in a file name and a single letter as an input and RETURNS True if a player
Write a function that playerHasLastInitial(filename, char) that takes in a file name and a single letter as an input and RETURNS True if a player on the roster has a last name beginning with that character, otherwise False. We will reuse the cubsRoster.csv we used in hw3. We want to avoid loading the whole file into memory, so use a while loop and the file readline() method, NOT the readlines() or read() methods
>>> playerHasLastInitial('cubsRoster.csv', 'A') True >>> playerHasLastInitial('cubsRoster.csv', 'J') False >>> playerHasLastInitial('cubsRoster.csv', 'V') False >>> playerHasLastInitial('cubsRoster.csv', 'Z') True
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
