Write a Python program that simulates a wheel of fortune game.
The game is played as follows:
With each additional spin, you have the chance to win more money, or you might play the game-ending 1, 2, or 3, at which time the game is over and you keep whatever winnings you have accumulated.
Programming instructions:
Make sure your simulation is set up as a function using
def () with the number of simulations as input and return
the average amount won and max amount won from the
simulations.
Then call that function in another part of your program and give
the output formatted as shown below.
Furthermore, answer the following question in the comments of your code:
Example Output:
Average amount won = $xx.xx
Max amount won = $xx.xx
CODE:
import random
def simulate(s):
win_list = []
max_win = 0
sum_win = 0
for i in range(s):
win = 0
while(True):
n = random.randint(0,10)
if (n in [1,2,3]):
break
elif (n in [4,5,6]):
win += n
elif (n in [7,8,9,10]):
win += 2*n
else:
win = 0.5 * win
win_list.append(win)
sum_win += win
if win > max_win:
max_win = win
return ((sum_win/s),max_win)
avg,m = simulate(1000)
print("Average amount won = $",format(avg,'.2f'))
print("Max amount won = $",format(m,'.2f'))
OUTPUT:

Write a Python program that simulates a wheel of fortune game. The game is played as...
C# Code: Write the code that simulates the gambling game of craps. To play the game, a player rolls a pair of dice (2 die). After the dice come to rest, the sum of the faces of the 2 die is calculated. If the sum is 7 or 11 on the first throw, the player wins and the game is over. If the sum is 2, 3, or 12 on the first throw, the player loses and the game is...
This program should be in c++. Rock Paper Scissors: This game is played by children and adults and is popular all over the world. Apart from being a game played to pass time, the game is usually played in situations where something has to be chosen. It is similar in that way to other games like flipping the coin, throwing dice or drawing straws. There is no room for cheating or for knowing what the other person is going to...
in the game of roulette, a wheel consists of the ball falls into matches the number you selected, you win $35 38 slots numbered 0, 00,1,2, 3 6. To play the game, a metal ball is spun around the wheel and is allowed to fall i otherwise you lose $1. Compiete parts (a) through (a) below nto one of the numbered slots. if the number of the slot (a) Construct a probability distribution for the random variable X, the winnings...
Objective: To write a program to allow a game of Tic Tac Toe to be played, and to determine when the game is over Complete the TicTacToe program below. It will allow for a full game of Tic Tac Toe between two players, and it will tell you who won or if the game is over with no winner. Details: The TicTacToe board is stored in a 3x3 multidimensional list of characters containing spaces at the start of the game...
USE PYTHON ONLY Please write a Python program to let you or the user play the game of rolling 2 dice and win/lose money. Initially, you have 100 dollars in your account, and the dealer also has 100 dollars in his/her account. You would be asked to enter a bet to start the game. If your bet is zero, the game would be stopped immediately. Otherwise, dealer would roll 2 dice and get a number from ( random.randint(1, 6) +...
In the game of roulette, a wheel consists of 38 slots numbered 0.00, 1.2.36. To play the game, a metal ball is spun around the wheel and is allowed to fall into one of the numbered slots in the number of the let the ball fall into matches the number you selected, you win $35; otherwise you lose $1. Complete parts (a) through (a) below. ber t he standard nommal darbuon page 1. Sick here the standard nomadsbution table (page...
Please write a Python program to check a tic-tac-toe game and show its winning result in detail. This is an application program of a 3-dimensional list or array. Your complete test run output must look as follows. This test really checks to make sure your program is performing perfectly to check every possible winning situation for X and O. GAME 0 is as follows: OOO OOO OOO O won by row 1 O won by row 2 O won by...
Please i need helpe with this JAVA code. Write a Java program simulates the dice game called GAMECrap. For this project, assume that the game is being played between two players, and that the rules are as follows: Problem Statement One of the players goes first. That player announces the size of the bet, and rolls the dice. If the player rolls a 7 or 11, it is called a natural. The player who rolled the dice wins. 2, 3...
Write a c++ program that simulates a million of games in craps. I am having a trouble getting to loop a million of times. I am trying to use a const for a million. This is the code so far. #include <iostream> #include <cstdlib>// contains prototypes for functions srand and rand #include <ctime>// contains prototype for function time #include <iomanip> using namespace std; int rollDice(); // rolls dice, calculates and displays sum void printstats(); int totroll = 0, games, point,...
Lab #6 Number Guessing Game – Loops and Nested Loops Requirements: Design, develop, test, and submit a program for a Number Guessing game. The program will select a random number between 0 and 100, allow the user to try up to 10 times to guess the number, and tell the user if each guess is too high, too low, or correct. The actual game portion must be a function...you can use more than one function in your program. The amount...