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
Abrake has a normal braking torque of 2.8 kip in and heat-dissipating cast-iron surfaces whose mass is 40 lbm. suppose a load is brought to rest in 8.0 s from an initial angular speed of 1600 rev/min using the normal braking torque; estimate the temperature rise of the heat dissipating surfaces.
Answers: 3
question
Engineering, 04.07.2019 18:10
Which of the following ziegler nichols tuning methods the response of the controller to a step input should exhibit an s-shaped curve? a)-open loop mode b)-closed loop mode c)-both modes (open & closed) d)-none of the modes (open & closed)
Answers: 3
question
Engineering, 04.07.2019 18:10
Which one from below is not one of the reasons of planning failures? (clo3) a)-planner is careless. b-planner spend less time in the field but more time on the desk c)-planner is not qualified d)-planner does not have sufficient time to properly plan
Answers: 3
question
Engineering, 04.07.2019 18:20
Aquick transition of the operating speed of a shaft from its critical speed will whirl amplitude. (a) increase (b) limit (c) not affect (d) zero
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
Mathematics, 22.04.2020 18:32
question
Mathematics, 22.04.2020 18:32
question
Mathematics, 22.04.2020 18:33
Questions on the website: 13722362