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
Using Word, Maureen is writing an outline of a presentation she plans to give to her company. She will be showing a video during
svlad2 [7]
A copy and paste would be fastest and easiest. As you can pinpoint the exact location to where you want the picture to be. 
5 0
3 years ago
Read 2 more answers
Write a short paragraph explaining why cross-training employees is imperative.
harina [27]
<span>One of the main deterrents to cross-training is how employees feel about retaining knowledge. An employee may feel their job is threatened if someone else is being trained in their function. It's important that you lay these woes to rest and explain why you are cross-training your employees.</span>
4 0
3 years ago
Which new jobs will be in demand in the next 20 years
s2008m [1.1K]
The answer is Data Jobs, Data Analysis, Solution Architecture, Software Engineering and Product Managers, there is many more but there's just a few. Hope I helped! :)
3 0
3 years ago
Draw a flowchart or write pseudocode to represent the logic of a program that allows the use to enter values for the width and l
DIA [1.3K]
In psuedocode it would be:

length = input()
width = input()

area = length * width

print(area + " sq ft");

3 0
3 years ago
Who likes video games
polet [3.4K]
I wish i could play but my strict mom would never let me :’(
3 0
3 years ago
Other questions:
  • 10. Which of these is not an HTTP verb? PUT AJAX GET DELETE
    12·1 answer
  • Explain the difference between general-purpose and specialized applications. Also discuss the common features of application pro
    11·1 answer
  • Jacob is preparing a presentation on the health and social advantages of taking up a sport at an early age. Most of the slides i
    12·1 answer
  • True or false? Compared to verbal language a shot is like a word
    12·1 answer
  • Which folder does the ipad saves my pictures?
    14·2 answers
  • Meaning of sperm count
    5·2 answers
  • Hello! I am a new coder, so this is a simple question. But I am trying to create a code where you enter a number, then another n
    8·1 answer
  • why does planets orbit the sun? asap i give brainlist i know it on that subject i dont know what else goes with it
    10·1 answer
  • Consider the following code segment, which is intended to simulate a random process. The code is intended to set the value of th
    13·1 answer
  • On a wireless network use _____ to ensure that only authorized client computers are able to access the wireless network.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!