 # Answered! In Python Code. Can you please code. Write a function called play_crapps(num_loaded) that simulates playing one…

In Python Code. Can you please code. Write a function called play_crapps(num_loaded) that simulates playing one round of crapps. Use the functions fair_die(), loaded_die, roll(), and make_point() to develop a full simulation model for one round of the game craps depicted in the image above. This function should take as input the number of loaded dice (with the default set to 0). This function should return an integer value of 1 if you win and an integer value of 0 if you lose.

def main():
• ```    x = eval(input("how many games will be played?: "))
y = simNGames(x)
print(y)

def simOneGame():
win = 0
lose = 0
x = rollDice()
if x == 2 or x == 3 or x == 12:
lose += 1
elif x == 7 or x == 11:
win += 1
y = rollDice()
while y != 7 or y != x :
y = rollDice()
if y == x:
win += 1
elif y == 7 :
lose += 1

if win > lose:
return(1)
else:
return(0)

def simNGames(n):
wins = 0
loses = 0
x = simOneGame()
for i in range(n):
if x > 0:
wins += 1
else:
pass
frac = wins / n
return float(frac)

def rollDice():
return rollDie() + rollDie()

def rollDie():
return randrange(1,7)```

Don't use plagiarized sources. Get Your Custom Essay on
Answered! In Python Code. Can you please code. Write a function called play_crapps(num_loaded) that simulates playing one…
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS \$13/PAGE