CSCI 150 - Foundations of Computer Science
Fall 2013
Programming Exercises: Chapter 5, part 7
- Do Exercises 5.23, 5.29, 5.30
- Write a function called
baskeballOutput(roster, filename)
that outputs to a file a roster of basketball players as defined
previously.
- Write a function called
basketballInput(filename) that
returns a roster of basketball players and their statistics as a list of lists.
Example of using these functions:
>>> roster = [['Larry Bird', 20, 10], ['Charles Barkley', 30, 5], ['Michael Jordan', 40, 1]]
>>> basketballOutput(roster, 'players1.txt')
>>> basketballInput('players1.txt')
[['Larry Bird', 20, 10], ['Charles Barkley', 30, 5], ['Michael Jordan', 40, 1]]