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
anastassius [24]
3 years ago
6

Modify the guessing-game program so that the user thinks of a number that the computer must guess.

Computers and Technology
1 answer:
olga_2 [115]3 years ago
5 0

Answer:

import random

import math

smaller = int(input("Enter the smaller number: "))

larger = int(input("Enter the larger number: "))

count = 0

print()

while True:

   count += 1

   myNumber = (smaller + larger)

   print('%d %d' % (smaller, larger))

   print('Your number is %d' % myNumber)

   choice = input('Enter =, <, or >: ')

   if choice == '=':

       print("Hooray, I've got it in %d tries" % count)

       break

   elif smaller == larger:

       print("I'm out of guesses, and you cheated")

       break

   elif choice == '<':

       larger = myNumber - 1

   else:

       smaller = myNumber + 1

Explanation:

  • Inside an infinite while loop, add the smaller and larger number and assign that value to myNumber variable.
  • Check the choice and then print the relevant display message.
You might be interested in
What does an operating system do?
Vinvika [58]
It uses a special 'language' or code to tell it what to do a what times, why, and how.  It gives the Computer an 'easier' Operating System (OS) to run on / off of.  The OS makes The Computer easier for us, to use and understand.
8 0
3 years ago
11.
dsp73
11. <span><span>their population crashed.
</span><span>
12. </span></span><span>dead zone

13. I believe </span><span>energy efficient</span>
4 0
3 years ago
Read 2 more answers
Households pay taxes to the government and receive public services. Which of the following is a public service?
Gwar [14]
C. Roads  this is the correct answer
8 0
3 years ago
What is one way you can learn about your digital footprint?
Pie

Answer:

Information could be gathered using cookies, which are small files websites store on your computer after your first visit to track user activity.

Explanation:

3 0
2 years ago
Put these operating systems in order according to the date they were released. (The first to be released would be
uysha [10]
1. ms-dos 1981
2. windows 2.0 1987
3. windows xp 2001
4. mac os 2001
5. windows 7 2009
8 0
3 years ago
Other questions:
  • Which of the following accurately completes this sentence? The Internet is ____.
    6·2 answers
  • Which windows tool is used to determine if a dynamic disk is corrupted?
    6·1 answer
  • Clep allows students to do all of thw following except which?
    11·2 answers
  • What is meant by encapsulating semaphores? Bring out the need for it
    12·1 answer
  • Part cost Calculator Modify the GUI in your program to look like the following GUI. To do that you need to add the following to
    13·1 answer
  • Pamela finds that she is constantly spelling the word “color” as “colour” when she is typing. Even though this is how the word i
    11·1 answer
  • What is WEB 1.0 to WEB3.0
    11·1 answer
  • question i need a real answer cuase i have a virus cuase off my borther and these are the notifacations i get and now these site
    11·1 answer
  • Where is information stored in the computer?​
    9·1 answer
  • Given positive integer n, write a for loop that outputs the even numbers from n down to 0. If n is odd, start with the next lowe
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!