# Question 4 use 1000 times each time simulating the mon

• 12
• 100% (3) 3 out of 3 people found this document helpful

This preview shows page 4 - 6 out of 12 pages.

Question 4. Use simulate_several_key_strikes 1000 times, each time simulating the mon- key striking 11 keys. Compute the proportion of times the monkey types "datascience" , calling that proportion datascience_proportion .
Question 5. Check the value your simulation computed for datascience_proportion . Is your simulation a good way to estimate the chance that the monkey types "datascience" in 11 strikes (the answer to question 1)? Why or why not? Question 6. Compute the chance that the monkey types the letter "e" at least once in the 11
strikes. Call it e_chance . Use algebra and type in an arithmetic equation that Python can evalute.
Question 7. Do you think that a computer simulation is more or less effective to estimate e_chance compared to when we tried to estimate datascience_chance this way? Why or why not? (You don’t need to write a simulation, but it is an interesting exercise.)
1.3 3. Sampling Basketball Players This exercise uses salary data and game statistics for basketball players from the 2014-2015 NBA season. The data was collected from Basketball-Reference and Spotrac . Run the next cell to load the two datasets. 4
In [47]: player_data = Table . read_table( ' player_data.csv ' ) salary_data = Table . read_table( ' salary_data.csv ' ) player_data . show( 3 ) salary_data . show( 3 ) <IPython.core.display.HTML object> <IPython.core.display.HTML object> We would like to relate players’ game statistics to their salaries, so we have computed a table called full_data that includes one row for each player who is listed in both player_data and salary_data using the table join method. It includes all the columns from player_data and salary_data , except the "PlayerName" column. In [48]: full_data = player_data . join( "Name" , salary_data, "PlayerName" ) full_data Out[48]: Name | Age | Team | Games | Rebounds | Assists | Steals | Blocks | Turnove A.J. Price | 28 | TOT | 26 | 32 | 46 | 7 | 0 | 14 Aaron Brooks | 30 | CHI | 82 | 166 | 261 | 54 | 15 | 157 Aaron Gordon | 19 | ORL | 47 | 169 | 33 | 21 | 22 | 38 Adreian Payne | 23 | TOT | 32 | 162 | 30 | 19 | 9 | 44 Al Horford | 28 | ATL | 76 | 544 | 244 | 68 | 98 | 100 Al Jefferson | 30 | CHO | 65 | 548 | 113 | 47 | 84 | 68 Al-Farouq Aminu | 24 | DAL | 74 | 342 | 59 | 70 | 62 | 55 Alan Anderson | 32 | BRK | 74 | 204 | 83 | 56 | 5 | 60 Alec Burks | 23 | UTA | 27 | 114 | 82 | 17 | 5 | 52 Alex Kirk | 23 | CLE | 5 | 1 | 1 | 0 | 0 | 0 ... (482 rows omitted) Basketball team managers would like to hire players who perform well but don’t command