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]
3 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]3 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
What should you do if you do not understand the directions on a test?
Cloud [144]

Answer:

ask your teacher for a little guidence.

Explanation:

even though you may not get the answer you need they might give you some assitance

3 0
3 years ago
Read 2 more answers
Change the file name for index.html to index.php
Damm [24]

The PHP code is given below:

<h3>PHP code</h3>

if(isset($_REQUEST['login_btn'])){

       $email = filter_var(strtolower($_REQUEST['email']),FILTER_SANITIZE_EMAIL); //strtolower changes email to all lower case

       $password = strip_tags($_REQUEST['password']);

The remaining code is in the file attached.

 

Read more about PHP here:

brainly.com/question/27750672

#SPJ1

Download txt
4 0
2 years ago
What is required for sitting with your seatbelt on while driving?
Alexxandr [17]
It should be D I believe
5 0
3 years ago
6
Lisa [10]

Answer C in the paragraph group on the home tab

8 0
3 years ago
What does a new database contain?
vova2212 [387]

As it is already known, a database is a collection of information. A new database contains a single file. This single file contains the 5 major database objects which are the typical components of a database. These objects include tables, queries, forms, reports, and macros. When you create a new database, what you get is an empty file with no tables or the above objects. However, when there is an input of data, these objects become active.

3 0
4 years ago
Other questions:
  • The design activity key question, "how will this system interact with other systems..." is part of which design activity?​
    7·1 answer
  • You are setting up a desktop computer for an AutoCAD specialist who needs a minimum of 125GB of RAM. Which operating system belo
    6·1 answer
  • Which steps can you use to open the Reveal Formatting pane?
    5·2 answers
  • List the six external peripheral parts of a computer system
    8·1 answer
  • Sally needs to copy data from the first worksheet to the fifth worksheet in her workbook. Which combination of keys will she use
    11·2 answers
  • What will be the output of the following code snippet? token = False while token : print("Hello")
    11·1 answer
  • Destinguish between qualitative data and quantitave
    12·1 answer
  • The ________ utility automatically creates duplicates of your libraries, desktops, contacts, and favorites to another storage lo
    6·1 answer
  • 4. Use the information under the Nutrients That the Human Body Needs title to create a multilevel list. Your list should meet th
    8·2 answers
  • "Automated Deployment" is one of the prerequisite for DevOps implementation.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!