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
kaheart [24]
3 years ago
5

Write a program that plays a reverse guessing game with the user. The user thinks of a number between 1 and 10, and the computer

repeatedly tries to guess it by guessing random numbers. It’s fine for the computer to guess the same random number more than once. At the end of the game, the program reports how many guesses it made.
Computers and Technology
1 answer:
nika2105 [10]3 years ago
4 0

Answer:

  1. import random  
  2. target = 7  
  3. count = 0
  4. for i in range(100):
  5.    guess = random.randint(1,10)  
  6.    
  7.    if(guess == target):
  8.        count += 1
  9. print("Total of correct guess: " + str(count))

Explanation:

The solution is written in Python 3.

Firstly, import the random module since we are going to simulate the random guess by computer. Next, we presume user set a target number 7 (Line 3). Create a counter variable to track the number of correct guess (Line 4).

Presume the computer will attempt one hundred times of guessing and we use randint to repeatedly generate a random integer between 1 - 10 as guess number (Line 6). If the guess number is equal to the target, increment count by one (Line 8-9).

Display the total number of right guess to terminal (Line 11).  

You might be interested in
A newly opened law firm in Kirkland decides to create a small website that provides a brief introduction of the firm, its missio
Ivan

Answer:

Flat web architecture

Explanation: A flat web architecture is a type of web Structure where to link chain exists, in this type of web architecture,users can access the web site with few number of clicks such as in one, two or three clicks with a maximum of four clicks.

One of the basic importance when dealing with web pages is the number of clicks before the page requested can be reached. The lower the number of clicks the better.

5 0
3 years ago
Suppose we wish to put a set of names in alphabetical order. We call the act of doing so sorting. One algorithm that can accompl
Sergeeva-Olga [200]

Answer:

See explaination

Explanation:

We refer to a compiler as a special program that processes statements written in a particular programming language and turns them into machine language or "code" that a computer's processor uses. Typically, a programmer writes language statements in a language such as Pascal or C one line at a time using an editor.

Please kindly check attachment for the step by step solution

3 0
3 years ago
What is the final value for X ?<br><br> x= 1<br><br> x=13<br><br> x= x+3<br><br> x=0
a_sh-v [17]

Answer:

x=13

Explanation:

6 0
3 years ago
What are two types of organizational structures designed to help an organization achieve its goals and objectives?
Fittoniya [83]

The answer is entrepreneurial and bureaucratic. Organizations that are large and small can achieve higher sales and other profit by properly matching their needs with the structure they use to operate.   the structure of an organization can help or hinder its progress toward accomplishing these goals and This are specific set up of organizations and ways to accomplish different goals. 

4 0
3 years ago
Read 2 more answers
Your motherboard supports dual channeling and you currently have two slots populated with DIMMs; each module holds 2 GB. You wan
Olenka [21]
One 4-GB DIMM. Dont really have a explanation for it just comes from previous experience
6 0
3 years ago
Read 2 more answers
Other questions:
  • What should you do before cleaning the top of a storage battery and rinsing it with fresh water?
    12·1 answer
  • If your problem is caused by a bad hardware or software installation and you get an error message the first time you restart the
    6·1 answer
  • Write a program that tells what coins to give out for any amount of change from 1
    6·1 answer
  • What is the standard internet protocol, which provides the technical foundation for the public internet?
    9·1 answer
  • Post as a reply your example of "data, which is processed into information" case - examples should not necessarily be related to
    13·1 answer
  • A document created by the scriptwriter that contains general information about a program is called _____.
    15·1 answer
  • Which network component is used to connect one network to another? Which component delivers the message to the destination compu
    5·1 answer
  • You work for a company that builds custom PCs for select clients. You are training a new employee to evaluate and select appropr
    13·1 answer
  • If your TV was showing a flat black or blue screen, or had "snow", what steps would you take to fix it?
    13·1 answer
  • Speed(?)
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!