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
Aflywheel accelerates for 5 seconds at 2 rad/s2 from a speed of 20 rpm. determine the total number of revolutions of the flywheel during the period of its acceleration. a.5.65 b.8.43 c. 723 d.6.86
Answers: 2
question
Engineering, 04.07.2019 18:10
At 12 noon, the count in a bacteria culture was 400; at 4: 00 pm the count was 1200 let p(t) denote the bacteria cou population growth law. find: (a) an expression for the bacteria count at any time t (b) the bacteria count at 10 am. (c) the time required for the bacteria count to reach 1800.
Answers: 1
question
Engineering, 04.07.2019 18:10
Shafts are machine elements that are used to a) carry axial loads b) direct shear loads c) transmit power d) rotate at constant speed e) none of the above circular and square shafts subjected to the same torque under the same circum behave a) the same way b) almost the same way
Answers: 2
question
Engineering, 04.07.2019 18:20
Inadequate stores control is not an obstacle to effective work order system. (clo4) a)-true b)-false
Answers: 3
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, 07.07.2019 02:30
question
Chemistry, 07.07.2019 02:30
question
Mathematics, 07.07.2019 02:30
Questions on the website: 13722363