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
A malware-infected networked host under the remote control of a hacker is commonly referred to as:
natali 33 [55]

Answer:

Option a: Trojan

Explanation:

A Trojan or Trojan horse is one of the computer malware that exist in computing world. Trojan often appears as a legitimate software to deceive user to activate it by social engineering. Once the Trojan is activated in the user computer, a hacker can remote control the infected computer for malicious purposes such as removing files, sending files, displaying message or rebooting computer.

However, Trojan cannot be replicated in the infected computer.

7 0
3 years ago
Read 2 more answers
The computer that can be used for performing the daily life tasks that might include emailing, browsing, media sharing, entertai
ad-work [718]

Answer:

Yes, this statement is completely true

Explanation:

Yes, this statement is completely true. A personal computer is a multimedia machine and can be used to complete an incredibly large number of tasks with ease. Such tasks include all of the ones listed in the question. Aside from that other tasks depend more on the skill level and understanding of the user. For example, an individual who has a vast understanding of technology and programming can create software to perform absolutely any task they may want or need to do.

5 0
3 years ago
Which process is used to protect transmitted data in a vpn?
wlad13 [49]
Here is the answer: <span>Tunneling</span>
3 0
3 years ago
A byte in memory is identified by a unique number called its
Murrr4er [49]
It is identified by its address number.
4 0
3 years ago
Someone help me
valkas [14]

The program is an illustration of loops.

Loops are used to perform repetitive and iterative operations.

The program in C++ where comments are used to explain each line is as follows:

#include <iostream>

using namespace std;

int main(){

   //This declares and initializes all variables

   string star = "*", blank = " ", temp;

   //The following iteration is repeated 8 times

   for (int i = 1; i <= 8; i++) {

       //The following iteration is repeated 8 times

       for (int j = 1; j <= 8; j++) {

           //This prints stars

           if (j % 2 != 0) {

               cout << star;

           }

           //This prints blanks

           else if (j % 2 == 0) {

               cout << blank;

           }

       }

       //This swaps the stars and the blanks

       temp = star;

       star = blank;

       blank = temp;

       //This prints a new line

       cout << endl;

   }

}

Read more about similar programs at:

brainly.com/question/16240864

5 0
3 years ago
Other questions:
  • What is the body of scientific knowledge based on?
    7·2 answers
  • A file must be ________ before data can be written to or read from it. closed opened buffered initialized none of these
    11·2 answers
  • Skinner designed a soundproof apparatus, often equipped with a lever or bar, with which he conducted his experiments in operant
    9·1 answer
  • This graph shows both a reflection and a
    14·2 answers
  • Fred wants to analyze his spending habits of the past few years and has gathered information on the checks he has written from 2
    6·1 answer
  • All systems have ___________.
    9·2 answers
  • Why do you classify computers?
    6·1 answer
  • a. Fill in the blanks with suitable words: A software that controls and manages all the activities of the computer ... b. A soft
    13·1 answer
  • If there are 18 people in your class and you want to divide the class into programming teams of 3
    7·1 answer
  • Compare and contrast the advantages and disadvantages of a LAN to a WLAN.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!