[Solved]Begin Creating File Called Pa09py File Create Function Called Readdata Function Take Sing Q37022779
- Begin by creating a file called pa09.py.

- In this file create a function called readData(). This functionshould:
- take in a single parameter that is the file name you want toread.
- open the file.
- each line in this data file should be read as a list, and theneach line list should be then appended to a master data list.
- you should ignore the “garbage” rows from the player_career.csvfile and not add those lines to your list.
- close the file
- return the master data list, which is a list of line lists. (Inother words, you should return a list of length 4051. Each elementin the list is itself a list representing the career stats of asingle player)
- the function should look something like this:

- Note: If you try to print this master_data_list, it is sobig that the print buffer may eat up all your memory and stall yourprogram. To make sure you are creating the list right, make a copyof the input file and delete all but the first 10 lines in notepador textedit. Now the list will be small enough that it can beprinted.
- Write a function called points(). This function should:
- take in one parameter – a list of player data (this will be thedata you “loaded” and “cleaned” using readData())
- For each player in the data list you should create a listconsisting of the points the player earned and the player’sname)
- Each of these lists should be appended to a separate list.
- When you are done processing the input data you should returnthis new list of lists.
- The function should look something like this:

- Write a function called main(). This function should:
- take no parameters
- invoke readData() to get the data about all of the players fromour stat file
- send the list returned by readData() to points()
- sort the list returned by points() to identify and printinformation about the ten players from this data file who scoredthe most points during their careers.
- The function should look something like this:

When you are all done you should beable to load and invoke main() from the shell and get a responsethat looks like the following:

Your Assignment, Part 2
- Write additional functions called minutes() and freethrows().These functions should work just like the points() function does.That is, they should take in the main data list, process eachplayer in the list to make appropriate lists, and return a list ofthese lists.
- You should also modify your main() method so that it prints theten players with the largest number of each ofthese items. When I run this function I should see a long screendump of the top 10 players in each of these three statisticcategories:

Your Assignment, Part 3 – The Efficiency Statistic
Each of the above statistics is interesting, but it only tellsus how good a player is at one specific statistic. How do many NBAcoaches quickly evaluate a player’s overall game performance? Theycheck his efficiency. This statistic is something like the QBpasser rating we calculated earlier in the course. It is acalculation that tries to assign a number to how “well” a playerplayed the game. Higher numbers mean a better performance from thatplayer.
NBA.com evaluates all players based on the efficiency formulaindicated below (and shown on the aboutstats.htm page). In thisproject, we will follow this efficiency formula. Since we are notevaluating a player based on one game, we need to divide the totalefficiency by the number of games the player played. So the formulais:

The abbreviations on the right hand side of the equationcorrespond to the fields in the statistics file. Again, you cancheck out the the meanings of each of the abbreviations at:http://www.databasebasketball.com/about/aboutstats.htm
- Create a function called efficiency(). Thisfunction should behave very similarly to the functions you wrote inparts 1 and 2 in that it should:
- take in one parameter – a list of player data (this will be thedata you “loaded” and “cleaned” using readData())
- For each player in the data list you should create a listconsisting of the player’s career long efficiency and the player’sname)
- Each of these lists should be appended to a separate list.
- When you are done processing the input data you should returnthis new list of lists.
- Now modify main() so that it uses this as it has the priorfunctions.

player_career_mac firstname lastname leag gp minutes pts oreb dreb reb asts blk turnover pf fga fgm fta ftm tpa tpmm ID ABDELAL01 Alaa ABDULKA01 Kareem Abdul-jabbar N 1560 57446 383872975 9394 17440 5660 1160 3189 ABDULMA01Mahmo Abdul-rauf N ABDULTA01 Tariq ABDURSH01 Shareef Abdur-rahimN ABERNTO01 Tom ABLEF001 Forest ABRAMJ001 John ACKERALO1 Alex ACKERDO01 Donald Ackerman ACRESMA01 Mark ACTONCH01 Charles Actorn ADAMSAL01 Alvan ADAMSD001Don ADAMSD001 Don ADAMSGE01 George Adams AdamsHa01 Hassan Adams ADAMSMI01 Michael Adams ADDISRA01 Rafael ADELMRI01Rick AfflaAr01 AgerMa01 Maurice Ager AGUIRMA01 Mark Abdelnaby N 256 3200 1465283 563 846 85 7169 247 484 1236 620 321 225 2527 4657 28307 15837 9304 6712 18 1 963 1107 7943 3514 1161 1051 1339 474 309 485 1726 720 529 372 76 18 2136 2324 11515 5434 4943 4006 519 154 58615633 8553 219 868 1087 2079 487 46 236 4808 1830 286 490 776 266 184 82 830 28883 15028 1869 4370 6239 2109 820 638 319 Abdul-wahad N Abernethy N 5434 1779 374 637 1011 384 185 60 129 525 1472 724 443 331 AbramovicN 0 533 234 220 0 37 29 16 15 23 0 0 0 171 855 203 185 127 0 0 Acker 9 20 92 34 10 525 0 0 0 43 14 28 15 375 5982 1343 581 944 1525 180 137 104 235 932 1016 514 463 308 13 195 770 0 47 11 0 35 74 29 29 9 00 Adams Adams Adams 988 27203 13910 2015 4922 6937 4012 1289 808 2194 3214 11464 5709 3160 2490 15 507 13132 4497 364 960 2848 957 321 62 52 1671 4437 1781 1263 935 342 101 21 47 68 54 13 27 38 42 22 17 215 3903 1652 0 668 873 317 859 292 372 1440 716 272 216 174 72 653 20446 9621 416 1484 1900 4209 1081 67 379 5697 2186 262 515 777 339 14883 462 10427 3579 41 123 1129 1606 106 149 2211 639 66 205 271 96 59 21 549 185 36 48 84 14 18 26 51 148 79 42 27 1 1402 1193 7849 3257 2543 2158 2857 949 284 671 2047 920 359 277 245 69 0 990 3330 1381 1146817 00 77 227 541 230 158 126155 53 Addison Adelman Afflalo 469 154 8 36 4418 25 60 177 58 5330 40 923 27730 18458 1704 2874 4578 2871 687 296 2306 2599 14865 7201 4944 3664 1258 392 uirre def readData (filename) #open the filename #do stuff return master data list def points (master data list): #do stuff return points list def main): #read the file only once with readData master_data_listreadData (“player_career.csv”) #pass the master-data-list into the points function fa specialized points-list is returned that we can sort points_list-points (master_data_list) #sort the points-list #print the top ten players and points from the points list >>>main () Top 10 players based on total points scored. Kareem Abdul-jabbar-38387 Karl Malone-36928 Michael Jordan-32292 Wilt Chamberlain-31419 Shaquille O’neal-27619 Moses Malone-27409 Elvin Hayes-27313 Hakeem Olajuwon-26946 Oscar Robertson-26710 Dominique Wilkins-26668 >>>main () Top 10 players based on total points scored Kareem Abdul-jabbar-38387 Karl Malone-36928 Michael Jordan-32292 Wilt Chamberlain-31419 Shaquille O’neal-27619 Moses Malone-27409 Elvin Hayes-27313 Hakeem Olajuwon-26946 Oscar Robertson-26710 Dominique wilkins-26668 Top 10 players based on total minutes Kareem Abdul-jabbar-57446 Karl Malone-54852 Elvin Hayes-50000 Wilt Chamberlain-47859 John Stockton-47765 Reggie Miller-47622 Gary Payton-47123 John Havlicek-46471 Robert Parish-45712 Moses Malone-45071 Top 10 players based on total free throws. Karl Malone-9787 Moses Malone-8531 Oscar Robertson-7694 Michael Jordan-7327 Jerry West-7160 Adrian Dantley-6832 Kareem Abdul-jabbar-6712 Dolph Schayes-6712 Charles Barkley-6349 Allen Iverson-6271 (pts + reb + asts + stl + blk)-((18a-fgrn) + (fta-ftm) + turnover) 8p Efficiency = Top 10 players based on total efficiency. Wilt Chamberlain-41.49760765550239 Spencer Haywood-37.80952380952381 Artis Gilmore-33.12619047619047 Julius Erving-32.26044226044226 Bill Russell-31.7061266874351 Oscar Robertson-31.614423076923078 Bob Pettit-31.108585858585858 Kareem Abdul-jabbar-30.9275641025641 Connie Hawkins-30.299145299145298 Larry Bird-29.767001114827202 Show transcribed image text player_career_mac firstname lastname leag gp minutes pts oreb dreb reb asts blk turnover pf fga fgm fta ftm tpa tpmm ID ABDELAL01 Alaa ABDULKA01 Kareem Abdul-jabbar N 1560 57446 383872975 9394 17440 5660 1160 3189 ABDULMA01Mahmo Abdul-rauf N ABDULTA01 Tariq ABDURSH01 Shareef Abdur-rahimN ABERNTO01 Tom ABLEF001 Forest ABRAMJ001 John ACKERALO1 Alex ACKERDO01 Donald Ackerman ACRESMA01 Mark ACTONCH01 Charles Actorn ADAMSAL01 Alvan ADAMSD001Don ADAMSD001 Don ADAMSGE01 George Adams AdamsHa01 Hassan Adams ADAMSMI01 Michael Adams ADDISRA01 Rafael ADELMRI01Rick AfflaAr01 AgerMa01 Maurice Ager AGUIRMA01 Mark Abdelnaby N 256 3200 1465283 563 846 85 7169 247 484 1236 620 321 225 2527 4657 28307 15837 9304 6712 18 1 963 1107 7943 3514 1161 1051 1339 474 309 485 1726 720 529 372 76 18 2136 2324 11515 5434 4943 4006 519 154 58615633 8553 219 868 1087 2079 487 46 236 4808 1830 286 490 776 266 184 82 830 28883 15028 1869 4370 6239 2109 820 638 319 Abdul-wahad N Abernethy N 5434 1779 374 637 1011 384 185 60 129 525 1472 724 443 331 AbramovicN 0 533 234 220 0 37 29 16 15 23 0 0 0 171 855 203 185 127 0 0 Acker 9 20 92 34 10 525 0 0 0 43 14 28 15 375 5982 1343 581 944 1525 180 137 104 235 932 1016 514 463 308 13 195 770 0 47 11 0 35 74 29 29 9 00 Adams Adams Adams 988 27203 13910 2015 4922 6937 4012 1289 808 2194 3214 11464 5709 3160 2490 15 507 13132 4497 364 960 2848 957 321 62 52 1671 4437 1781 1263 935 342 101 21 47 68 54 13 27 38 42 22 17 215 3903 1652 0 668 873 317 859 292 372 1440 716 272 216 174 72 653 20446 9621 416 1484 1900 4209 1081 67 379 5697 2186 262 515 777 339 14883 462 10427 3579 41 123 1129 1606 106 149 2211 639 66 205 271 96 59 21 549 185 36 48 84 14 18 26 51 148 79 42 27 1 1402 1193 7849 3257 2543 2158 2857 949 284 671 2047 920 359 277 245 69 0 990 3330 1381 1146817 00 77 227 541 230 158 126155 53 Addison Adelman Afflalo 469 154 8 36 4418 25 60 177 58 5330 40 923 27730 18458 1704 2874 4578 2871 687 296 2306 2599 14865 7201 4944 3664 1258 392 uirre
def readData (filename) #open the filename #do stuff return master data list
def points (master data list): #do stuff return points list
def main): #read the file only once with readData master_data_listreadData (“player_career.csv”) #pass the master-data-list into the points function fa specialized points-list is returned that we can sort points_list-points (master_data_list) #sort the points-list #print the top ten players and points from the points list
>>>main () Top 10 players based on total points scored. Kareem Abdul-jabbar-38387 Karl Malone-36928 Michael Jordan-32292 Wilt Chamberlain-31419 Shaquille O’neal-27619 Moses Malone-27409 Elvin Hayes-27313 Hakeem Olajuwon-26946 Oscar Robertson-26710 Dominique Wilkins-26668
>>>main () Top 10 players based on total points scored Kareem Abdul-jabbar-38387 Karl Malone-36928 Michael Jordan-32292 Wilt Chamberlain-31419 Shaquille O’neal-27619 Moses Malone-27409 Elvin Hayes-27313 Hakeem Olajuwon-26946 Oscar Robertson-26710 Dominique wilkins-26668 Top 10 players based on total minutes Kareem Abdul-jabbar-57446 Karl Malone-54852 Elvin Hayes-50000 Wilt Chamberlain-47859 John Stockton-47765 Reggie Miller-47622 Gary Payton-47123 John Havlicek-46471 Robert Parish-45712 Moses Malone-45071 Top 10 players based on total free throws. Karl Malone-9787 Moses Malone-8531 Oscar Robertson-7694 Michael Jordan-7327 Jerry West-7160 Adrian Dantley-6832 Kareem Abdul-jabbar-6712 Dolph Schayes-6712 Charles Barkley-6349 Allen Iverson-6271
(pts + reb + asts + stl + blk)-((18a-fgrn) + (fta-ftm) + turnover) 8p Efficiency =
Top 10 players based on total efficiency. Wilt Chamberlain-41.49760765550239 Spencer Haywood-37.80952380952381 Artis Gilmore-33.12619047619047 Julius Erving-32.26044226044226 Bill Russell-31.7061266874351 Oscar Robertson-31.614423076923078 Bob Pettit-31.108585858585858 Kareem Abdul-jabbar-30.9275641025641 Connie Hawkins-30.299145299145298 Larry Bird-29.767001114827202
Expert Answer
Answer to Begin by creating a file called pa09.py. In this file create a function called readData(). This function should: take in… . . .
OR

