Question: Please solve both of these problems step by step and please please be sure the sample output are ALL tested and accurate before you post

Please solve both of these problems step by step and please pleasebe sure the sample output are ALL tested and accurate before youPlease solve both of these problems step by step and please please be sure the sample output are ALL tested and accurate before you post solutions. Keep both methods as simple and basic as possible.

- the total is the same as the original total (from-1), in which case the player wins - the total is 7 , in which case the player loses Write a function craps that simulates a single game of craps (may be many rolls) and returns 1 if the player wins and 0 otherwise. [(0, None, 0), (1, None, 1), (2, None, 0), (3, None, 1), (4, None, 0),(5, None, 1), (6, None, 0), (7, None, 1),(8, None, 0), (9, None, 0), (10, None, 1), (11, None, 1), (12, None, 1), ( 13 , None, 1), (14, None, 0), ( 15 , None, 0), (16, None, 1), (17, None, 0), ( 18 , None, 0), (19, None, 1)] testcraps (Perkovic, Problem 6.31b) Write a function testcraps that accepts a positive integer n as an input, simulates n games and craps, and returns the fraction of games the player won. - the testcraps function should not make dice rolls directly, instead ... - testcraps function should call the craps function repeatedly and keep track of the results - if you your craps and testcraps function simulate the game correctly without any extra rolls, you should be able to hit the results below exactly random. seed (0) > testcraps (10000) 0.5 random. seed (1) >>> testcraps (10000) 0.4921 >>[(i, random.seed (i), testcraps (100i)) for i in range (1,10)] [(1, None, 0.49), (2, None, 0.46), (3, None, 0.47333333333333333), (4, None, 0.5125), (5, None, 0.476), ( 6 , None, 0.47333333333333333), (7, None, 0.4514285714285714), ( 8 , None, 0.48), ( 9 , None, 0.4855555555555556)]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!