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
Wewaii [24]
3 years ago
15

Write a program which simulate rolling dice. When the program runs, it will prompt the user to choose a number ranging from 1 to

6. It will then randomly choose a number between 1 and 6. The program will print the message "Your guess is correct!" if the guess number equals to the dice number, otherwise it will print "Wow! The dice number is --.". It should then ask the user if you’d like to roll again. Enter "1" to roll again and enter "0" to end the game. Concepts to keep in mind:
Concepts to keep in mind:
• Random
• Integer
• Print
• While Loops

Output:
Enter your guess number between 1 and 6: 5
Wow! The dice number is 1
Do you want to dice it up again:Enter 1 and if not enter 01
Enter your guess number between 1 and 6: 4
Wow! The dice number is 1
Do you want to dice it up again:Enter 1 and if not enter 01

Computers and Technology
1 answer:
Arada [10]3 years ago
5 0

Answer:

Written in Python

import random

tryagain = 1

while tryagain == 1:

guess = int(input("Enter your guess number between 1 and 6: "))

num = random.randint(1,7)

if guess == num:

print("Your guess is correct")

else:

print("Wow, the dice number is "+str(num))

tryagain = int(input("Do you want to dice it up again:Enter 1 and if not enter 0: "))

Explanation:

I've added the full source code as an image attachment where I used comments to explain difficult lines

You might be interested in
Which of the following is NOT true about variables?
VikaD [51]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The value stored by a variable can be changed after it is assigned(true).

The value of a variable can be changed after it is assigned, for example:

int a=10;

and we can change the value of variable a in letter program such as:

a=15;

Variables are a name for a spot in the computer's memory (true).

it is true, because the variables value stored in the computer's memory and we can access theses values by their name (variable name). so Variables are a name for a spot in the computer's memory.

Variable names can be words: such as temperature or height (true).

Yes, the variable name can be words such as height, width, temperature etc.

The value stored by a variable cannot be changed after it is assigned (false).

It is noted that the value stored by a variable can be changed after it is assigned. However, it is noted that is some programming language, you can't change the value of static variable.

3 0
3 years ago
Assume you are given three variables, revenue, expenses, and profit, all of type Money (a structured type with two int fields, d
Andre45 [30]

Answer:

if(revenue.cents - expenses.cents < 0){

profit.dollars = revenue.dollars - expenses.dollars - 1;

profit.cents = 1 - revenue.cents - expenses.cents;

}

else{

profit.dollars = revenue.dollars - expenses.dollars;

profit.cents = revenue.cents - expenses.cents;

}

Explanation:

We know that profit is given as: revenue - expenses from the question.

From the given expression above;

if(revenue.cents - expenses.cents < 0)

then profit.dollar will be revenue.dollars - expenses.dollars - 1; the 1 is to be carry over to the cent part. And the profit.cent will be 1 - revenue.cents - expenses.cents;

else the profit.dollars and the profit.cent is computed directly without needing to carry over:

profit.dollars = revenue.dollars - expenses.dollars;

profit.cents = revenue.cents - expenses.cents;

7 0
3 years ago
In a typical e-mail address, the "host" is user: which one of the following word processing features saves you the most time whe
gayaneshka [121]
Find-and-replace . hope this helps !
4 0
3 years ago
The language a person speaks is one example of ________________.
adoni [48]

Answer: b. Códigos de comunicación/ comunication codes

Explanation:

5 0
3 years ago
Read 2 more answers
A hacker corrupted the name:IP records held on the HOSTS file on a client, to divert traffic for a legitimate domain to a malici
balu736 [363]

The type of attack that the hacker performed is Domain Name System (DNS) server cache poisoning.

<h3>What is DNS poisoning?</h3>

In Domain Name System (DNS) server cache poisoning, the hackers often enter into a DNS server because they want to make an adjustment to its directory so that it can point the domain name users enter to a wrong, IP address.

Note that Domain Name Server (DNS) poisoning is a form of system attack in which there is the change of DNS records which are then used to redirect online traffic to a wrong website.

Learn more about hacker  from

brainly.com/question/24956493

7 0
2 years ago
Other questions:
  • Privileged instructions 1) generate an interrupt so they can execute before non-privileged instructions. 2) are valid only when
    5·1 answer
  • What acronym is used to reference the data link sublayer that identifies the network layer protocol encapsulated in the frame?
    13·1 answer
  • What is Hadoop?
    15·1 answer
  • Class sizes of various sections of college algebra at your university are an example of which type of data? quiizlet
    13·1 answer
  • Producers must understand the marginal benefit of making an additional unit which shows the ...
    5·2 answers
  • What port is typically reserved and utilized by the Secure Hypertext Transfer Protocol to create a secure connection to a Web se
    13·1 answer
  • I need help with this question. its in the photo
    10·1 answer
  • Of the 5 factors that should be evaluated when assessing information's quality (Validity, Reliability, Accuracy, Timeliness, and
    6·1 answer
  • You are the Emergency Management Director of a small island nation. Your nation has come under Cyber-attack and the attackers ha
    7·1 answer
  • Which image file format consumes the most file<br> space?<br> 0<br> GIF<br> JPEG<br> PNG
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!