Code due by Wed, 11/20 at 11:59pm
The purpose of this assignment is to give you more practice with functions, files, and lists while using a real data set populated with career data from NBA players!
Remember, before you begin this project, review the function commenting styles that I expect. This includes comments specifying inputs/outputs and the descriptive docstring. Please create the function comments before beginning the actual coding.
This is a big assignment! Start early!
Download one of the following csv files formatted for your computer:
The format of this file is easy to understand. Open the file by right clicking on the file and selecting "Open With" and selecting a text editor of some kind like Notepad++ or Wordpad. The first line tells you the names of all the columns (To understand the meanings of each of the abbreviations, look at this page). After that, each line's data corresponds to one player's career statistics. Each field is separated by a comma.
Notice that, in addition to the very first line, which is the header information, there appears to be a blank line followed by a line of "garbage" at the bottom of the file. This will become an issue later in the assignment.
I've decided to give you all one more assignment where I specify exactly what functions to create in case you are having troubles following your design from homework 8. You can choose to use my design or your design from homework 8. Either way, make sure the entire program starts when the autolab calls your main() function with no inputs.
At the end of this assignment, take a look at your design tree compared to the design I give you below. I'll want you to write a few paragraphs (Part 4 below) comparing my design to yours.
When you are all done you should be able to load and invoke main() from the shell and get a response that looks like the following:
Each of the above statistics is interesting, but it only tells us how good a player is at one specific statistic. How do many NBA coaches quickly evaluate a player's overall game performance? They check his efficiency. This statistic is something like the QB passer rating we calculated earlier in the course. It is a calculation that tries to assign a number to how "well" a player played the game. Higher numbers mean a better performance from that player.
NBA.com evaluates all players based on the efficiency formula indicated below (and shown on the aboutstats.htm page). In this project, we will follow this efficiency formula. Since we are not evaluating a player based on one game, we need to divide the total efficiency by the number of games the player played. So the formula is:
The abbreviations on the right hand side of the equation correspond to the fields in the statistics file. Again, you can check out the the meanings of each of the abbreviations at: http://www.databasebasketball.com/about/aboutstats.htm
This design tree would have 6 modules, one for each function -- main, readData, points, minutes, freethrows, and efficiency. Compare this design with the design tree you created in homework 8, and write two paragraphs stating:
mylist = [x,y]
To append this list to a list you can just say myList.append(mylist). Then
to access the
different items in the list you index into the list twice, so for example if
you appended the
above list as the first item in a list:
myList[0][0] would return x
myList[0][1] would return y
myList = [ [3,2], [1,2], [2,5]] myList.sort() # myList will be [ [1,2], [2,5], [3,2]] myList.reverse() # myList will be [ [3,2], [2,5], [1,2]]
Please upload your program and paragraphs to the program submission system. The program is worth 20 points, and the paragraphs are worth 5 points. The submission system will not autograde your paragraphs (I will do that manually at a later time). The program submission system will be running your main function and will give you more points for each top 10 list you are able to generate.