我有这个代码:
\nimport numpy as np\nfrom scipy import stats\nfrom matplotlib import pyplot as plt\n\nif __name__ == "__main__":\n # Create a list of the number of coin tosses ("Bernoulli trials")\n number_of_trials = [0, 2, 10, 20, 50, 500]\n # Conduct 500 coin tosses and output into a list of 0s and 1s\n # where 0 represents a tail and 1 represents a head\n data = stats.bernoulli.rvs(0.5, size=number_of_trials[-1])\n # Discretise the x-axis into 100 separate plotting points\n x = np.linspace(0, 1, 100)\n …Run Code Online (Sandbox Code Playgroud)