1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
LenKa [72]
2 years ago
8

Write a program that asks the user to guess the next roll of a six-sided die. Each guess costs $ 1. If they guess correctly, the

y get $ 100.00. The player will start out with a $10.00 bank. Each time he (or she) guesses incorrectly you will subtract $1.00 from their bank. Each time they guess correctly, you add $10.00 to their bank. Print the total winnings or losses at the end of the game. You can simulate the toss of the dice using the RandomRange function (Don't forget to Randomize).
Computers and Technology
1 answer:
jasenka [17]2 years ago
3 0

Answer in python:

import random

money = 10

winnings = 0

def main():

global winnings

global money

dice_num = random.randrange(1,6)

input_str = "Guess the dice number. You have $"+str(money)+" > "

input_num = input(input_str)

if int(input_num) == dice_num:

 money = money + 10

 winnings = winnings + 10

else:

 money = money - 1

if money < 0:

 print("You lose. You won "+str(winnings)+" times. Press enter to try again")

 useless_variable = input()

 main()

else:

 main()  

main()

Explanation:

You might be interested in
How do i unblock a website on a school computer if a school blocks it?
tresset_1 [31]

Answer:

look up ultrasurf and just follow the thingy and it will download a vpn ive had it on my computer for a fat min

Explanation:

4 0
2 years ago
Which option is the easiest way to configure macros in Access 2016?
zhuklara [117]
Number 2
Have a nice day
6 0
3 years ago
Which device protects computer systems from voltage fluctuations?
meriva
A fuse protects computer system from voltage fluctuations
6 0
2 years ago
Read 2 more answers
When was microsoft word for windows invented?
Dahasolnce [82]
1981 fue inventado por Bill gates y paul allen
4 0
3 years ago
Traditional methods of collecting systems requirements include: a. rapid application development. b. prototyping. c. interviews.
diamong [38]

Answer:

interviews

Explanation:

because the designer gets to directly interact with the customer who knows exactly what they want.

3 0
1 year ago
Other questions:
  • Which two software interfaces allow adjustment of the cpu voltage? (choose two.)?
    10·1 answer
  • What term is used to describe a function that uses an algorithm to convert an input of letters and numbers into an encrypted out
    9·1 answer
  • Electronic files created on a computer using programs such as word software are considered to be
    15·1 answer
  • Which of the following is NOT something you can specify in the bullets and numbering dialog box?
    8·1 answer
  • Data ____ travel over the Internet from router to router until reaching their destinations.
    7·1 answer
  • Whats the wire that connects to the wifi box
    15·2 answers
  • Coding 5 - Classes The Item class is defined for you. See the bottom of the file to see how we will run the code. Define a class
    13·1 answer
  • How does a computer do its work? Mention its working principle.<br><br>​
    8·1 answer
  • Why is it better for a CPU to have more than one cache?
    6·2 answers
  • What are three coding languages that are used to build websites?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!