Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please verify your code by running it and displaying the results Write a python function that playerHasLastInitial(filename, char) that takes in a file name and
please verify your code by running it and displaying the results
Write a python function that playerHasLastInitial(filename, char) that takes in a file name and a single letter as input
and RETURNS True if a player on the roster has a last name beginning with that character, otherwise False. We want to avoid loading the whole file into memory, so use a while loop and the file readline() method
run:
playerHasLastInitial('cubsRoster.csv', 'A')
file: cubsRoster.csv
Name | Age | CountryCode |
Jim Adduci | 34 | CA |
Albert Almora | 25 | US |
Adbert Alzolay | 24 | VE |
Javier Baez | 26 | PR |
Tony Barnette | 35 | US |
David Bote | 26 | US |
Brad Brach | 33 | US |
Kris Bryant | 27 | US |
Victor Caratini | 25 | PR |
Nicholas Castellanos | 27 | US |
Xavier Cedeno | 32 | PR |
Tyler Chatwood | 29 | US |
Steve Cishek | 33 | US |
Tim Collins | 29 | US |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started