In: Statistics and Probability
There are three basketball players, A, B, and C. A takes 30 shots a game, with a shooting percentage of 70%. B takes 20 shots, hitting 60%, and C takes 10 shots, hitting 50%.
write a program in java or Python. Use the above statement to simulate players A, B, and C in a season of 82 games. Generate a string of shots for each player in each game, length 30, 20, and 10 shots. Count the number of shots each makes.
Accumulate and make histograms of the following statistics:
Which of these histograms resemble a Normal distribution?
SOLUTION;-
GIVEN DATA;-
import random
A = [] # create an empty list for player A
B = [] # create an empty list for player A
C = [] # create an empty list for player A
for _ in range(30):
# create a bias of 70% chance
if random.random() <= 0.7:
A.append(1)
else:
A.append(0)
for _ in range(20):
# create a bias of 60% chance
if random.random() <= 0.6:
B.append(1)
else:
B.append(0)
for _ in range(10):
# create a bias of 50% chance
if random.random() <= 0.5:
C.append(1)
else:
C.append(0)
A_shots=sum(A)
B_shots=sum(B)
C_shots=sum(C)
print('Histogram')
print('A stats {0}/{1} -
{2}'.format(A_shots,len(A),'*'*A_shots))
print('B stats {0}/{1} -
{2}'.format(B_shots,len(B),'*'*B_shots))
print('C stats {0:>2}/{1:>2} -
{2}'.format(C_shots,len(C),'*'*C_shots))
Normal distribution will be for player C as the probability is 50%. The chance of shooting is 1 over 2 which is equal to 50%