Question: Based on Python Rules - If either player rolls a six, the game stops. The player with the higher die value wins. If both dice
Based on Python

Rules - If either player rolls a six, the game stops. The player with the higher die value wins. If both dice values are the same, then it is a tie. - If neither player has a six in the initial roll, then a player may re-roll under these conditions: - If the BANKER initially rolled a 3 or below, the BANKER will re-roll their die. - If the PLAYER initially rolled a 2 or below, the PLAYER will re-roll their die. - After this reroll, the game stops. The player with the higher die value wins. If both dice values are the same, then it is a tie. Tasks 1. The starter code has been created for you. You must use it with the two functions you will write, especially the outcones dictionary variable declared for you. 3. Complete the visualizeResults function. Use the seaborn barplot() to visualize the outcomes. 4. Function comments have been added for you. 5. Answer the questions below. import nunpy as np import matplotlib.pyplot as plt import seaborn as sns import random. import math def rollole( n ): This function creates a random number between 1 and n inclusive and returns it. Parameters m : int Upper bound of random number Returns int A random number between 1 and n inclusive die = random. randrange (1, n +1) return die def sinulateGanes( n, wins ) : This function simulateGame simulates several rounds of the gane. See the rules above for how each garte round is played. Pararteters n : int The number of games wins : dictionary A dictionary with keys "player", 'banker", "tie". All the values should be zero. Returns None pass I replace pass with your code def visualizeResults( numganes, wins): This function creates a bar plot of frequencies for each outcome using the seaborn package. It will show the frequency of outcones for the PLAYER, BANKER, and TIE out of 106\%. Recal1 that wins dictionary pararreter has a total count of outcomes and that you will need to find the percentage of occurrences. Parameters n. int The number of games wins : dictionary A dictionary with keys "player", "banker", "tie" with the total number of outcomes 'Player Wins', 'Banker Wins', and 'Ties" Returns None pass In replace pass with your code * Sonple driver code ganes =209990 \& Simulate 209990 games outcones = \{player': , "banker': , "tie": } " Dictionary to keep trock of outcomes sinulateGanes( ganes, outcones) "Coll function to simulate the gones
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
