Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions