Engineering
Engineering, 03.03.2020 20:51, 1tzM3

I want to know how to make these lines to work

In the game of Lucky Sevens, the player rolls a pair of dice. If the dots add up to 7, the player wins $4; otherwise, the player loses $1. Suppose that, to entice the gullible, a casino tells players that there are lots of ways to win: (1, 6), (2, 5), etc. A little mathematical analysis reveals that there are not enough ways to win to make the game worthwhile; however, because many people’s eyes glaze over at the first mention of mathematics, your challenge is to write a program that demonstrates the futility of playing the game.

Your program should take as input the amount of money that the player wants to put into the pot, and play the game until the pot is empty. At that point, the program should print the number of rolls it took to break the player, as well as maximum amount of money in the pot.

import random

# Request the input

dollars = int(input("How many dollars do you have? "))

# Initialize variables

maxDollars = dollars

countAtMax = 0

count = 0

# Loop until the money is gone

while

# Roll the dice

die1 = random. randint(1, 6) # 1-6

die2 = random. randint(1, 6) # 1-6

#Calculate the winnings or losses

if

else:

#If this is a new maximum, remember it

if

# Display the results

print("You are broke after " + str(count) + " rolls.\n" + \

"You should have quit after " + str(countAtMax) + \

" rolls when you had $" + str(maxDollars) + ".")

answer
Answers: 2

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, lerasteidl
Determine whether or not it is possible to compress air adiabatically from k to 140 kpa and 400 k. what is the entropy change during this process?
Answers: 3
image
Engineering, 04.07.2019 18:10, nandalabella06
True or false (explain) (110)[111] is a slip system in bcc metals . the {111} family in fcc contains 8 planes. resolved shear stress (rss) in single crystals is just related to the applied stress. critical resolved shear stress (crss) in single crystal metals is direct proportional to the number of defects in the structure
Answers: 2
image
Engineering, 04.07.2019 18:20, moneywaydaedae
Air is compressed isentropically from an initial state of 300 k and 101 kpa to a final temperature of 1000 k. determine the final pressure using the following approaches: (a) approximate analysis (using properties at the average temperature) (b) exact analysis
Answers: 1
image
Engineering, 04.07.2019 18:20, rjone8429
Asimple rankine cycle uses water as the working fluid. the water enters the turbine at 10 mpa and 480c while the condenser operates at 6 kpa. if the turbine has an isentropic efficiency of 80 percent while the pump has an isentropic efficiency of 70 percent determine the thermal efficiency
Answers: 1
Do you know the correct answer?
I want to know how to make these lines to work

In the game of Lucky Sevens, the player r...

Questions in other subjects:

Konu
Mathematics, 09.09.2021 23:20