the third image is my python code that does not work correctly. what do i need to change to get this to work?
Programming Assignment 1 In the early 1600s, Galileo was asked to explain the fact that, although 9 can be written as a sum of 3 integers in exactly the same number of ways as 10 can, 9=6+2+1=5+3+1=4+4+1=5+2+2=4+3+2 3+3+3 10=6+3+1 +5+4+1=6+2+2=5+3+2 4+4+2=4+3+3, when 3 fair dice are rolled, a 9 seemed to come up less often than a 10 supposedly, in the experience of gam- blers. Imagine you are a steampunk Galileo/ Galilea. And that some incorrigible gamblers have asked you to confirm and explain why, although, say, 34 can be written as a sum of 10 integers in exactly the same number of ways as 35 can, when 10 dice are rolled, a 34 seems to come up less often than a 35. Answer their and similar questions by writing a computer program (for your steam powered Turing machine) which takes as input a number d of dice and two numbers a, b, and which outputs whether a and b are equally likely to be the sums of a roll of d dice, or if not, which of the two is more likely Your program should accomplish this by simu- lating the roll of d dice a large number of times and keeping track of the proportion of times the sum is a and the proportion of times it is b Your program will have to decide (1) how many rolls to perform in order to reach its conclusion with confidence and (2) how close the simulated propor- tions need to be in order to conclude that the actual probabilities are equal. How could it do that? (2) When rolling d fair dice, there are 6 outcomes, cach having probability 1/6. So the probability of any event in this sam- ple space is an integer multiple of 6". Therefore, if two events do not have the same probability, then their probabilities ditter by at least 1 6. (1) We will learn more about this later but for now you may ap- ply the roul rule of thumb that, at least 9596 of the time, a simulation of this type with 7 trials produces an answer with more than I By combining these ide can make your programan wer the questions rectly of the time Programming Language. You may use any programming language you like to com- plete this assignment. But you are encouraged to use Python and specifically the scientific computing package NumPy. Here are instructions for installing it, and here is a reference for NumPy. The TA's will probably only be able to help you with your code if you use Python. With those installed, three random die rolls can be simulated with: import numpy x = numpy.random.randint (1,7) y = numpy.random.randint(1,7) z = numpy.random.randint (1,7) print(x+y+z) The first line imports the numpy library. The second, third, and fourth lines generate ran- dom integers in {1,2....,6}. The second argument to randint is 7. because according! to the documentation, randint(a,b) gives a random integer between a (inclusive) and b (exclusive). So, to make sure that we can get a 6 we have to make the second argument 7. The code then prints the result of summing the three die rolls. Faate Que vaunua 31, 2020 import random import numpy def most probable(d, a, b) : number a = 0 number b = 0 for i in range (1, int ((1/(6** (2*d))))): for i in range (l, d + 1): sum roll += numpy.random.randint (1,7) print (sum roll) if (sum_roll == a): number a += 1 sum roll = 0 print (number_a) elif (sum_roll == b): number b += 1 sum roll = 0 print (number_b) else: sum_roll - 0 12 (number_a == number_b): print(a, "and", b, "are Equally likely elif (number_b > number_a) : print (b, "is more likely") print (a, "is more likely") d ant (nput ("Enter the number of dice:)) Ta - int (input (enter a inst ) b = unt (input ("Enter a second sum probable - most probable (a, a, b)