subject
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) + ".")

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
The drive force for diffusion is 7 fick's first law can be used to solve the non-steady state diffusion. a)-true b)-false
Answers: 1
question
Engineering, 04.07.2019 18:10
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
question
Engineering, 04.07.2019 19:10
What is the main objective of using reheat rankine cycle?
Answers: 3
question
Engineering, 04.07.2019 19:10
10 kg of co2 is initially contained at 400 kpa and 300 k. the gas constant for carbon dioxide is 189 j/lkg k) and has a specific heat ratio, k, of 1.289. isentropic expansion then occurs until the pressure is 200 kpa. a) determine the initial volume of co2 in m. b) determine the final temperature in k. c) determine the work done by the system during the expansion kl.
Answers: 2
You know the right answer?
I want to know how to make these lines to work

In the game of Lucky Sevens, the player r...
Questions
question
Social Studies, 01.08.2019 08:00
question
Social Studies, 01.08.2019 08:00
Questions on the website: 13722367