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
Spreadsheet feature that can be used to arrange data from highest to lowest based on average<br>​
Juliette [100K]

Answer:

RANK.AVG

Explanation:

Required

Arrange data in descending order based on average

The feature to do this is to use the RANK.AVG() function.

By default, the function will return the ranks of the selected data in descending order (i.e. from highest to lowest); though, the sort order can be changed to ascending order.

The syntax is:

=RANK.AVG (number, ref, [order])

Where

number \to The number to use as rank

ref \to The cell range

order \to 0 represents descending order while 1 represents ascending order

8 0
3 years ago
How would you log in as zach if you did not know his password but knew the root password?
Nuetrik [128]
You can login in root terminal and then type #sudo Zach 
8 0
3 years ago
The given SQL creates a Movie table with an auto-incrementing ID column. Write a single INSERT statement immediately after the C
Snowcat [4.5K]

Answer:

INSERT INTO Movie(Title,Rating,ReleaseDate)

VALUES("Raiders of the Lost ArkPG",'PG',DATE '1981-06-15'),

("The Godfaher",'R',DATE '1972-03-24'),

("The Pursuit of Happyness",'PG-13',DATE '2006-12-15');

Explanation:

The SQL statement uses the "INSERT" clause to added data to the movie table. It uses the single insert statement to add multiple movies by separating the movies in a comma and their details in parenthesis.

3 0
3 years ago
The gradual wearing away or breaking down of rocks by abrasion is a type of __________________ weathering.
lesya [120]

Answer:

a.physical

Explanation:

3 0
3 years ago
Write an if-else statement that determines whether the variable points is outside the range of 9 to 51. If points is outside the
Mrac [35]

Answer: Using Python

Explanation:

num = int(input("Enter number > "))

if num in range (9, 52):

   print("Valid Points")

else:

   print("Invalid Points ")

8 0
2 years ago
Other questions:
  • Place the optical discs in the increasing order of storage capacity.<br><br> UDO<br> CD<br> DVD
    8·1 answer
  • A slide show is another name for a PowerPoint presentation. <br> a. True<br> b. False
    5·2 answers
  • 9. What is composition? Why is composition important?
    11·1 answer
  • What is an online recommendation engine?
    12·1 answer
  • The _____ dialog box lets you specify which files are to be merged.
    14·1 answer
  • Apple users tend to like the company and love its products. Apple has successfully nurtured this __________ component of its cus
    12·1 answer
  • Your organization is planning to deploy wireless access points across their campus network, and you have been tasked with securi
    5·1 answer
  • A type of graph that uses horizontal bars to compare data is called a
    15·2 answers
  • You have just read about a new security patch that has been made available for your Windows system, so you install the patch as
    6·1 answer
  • ________ are chunks of software - installed on one's computer, tablet, or smartphone - that are gateways to games, online resour
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!