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
List the difference between sdram and dram​
IRISSAK [1]

Answer:

i need this for a challenge

Explanation:

4 0
2 years ago
2. Create 4 riddleson keywords which is related to fire wall.​
Alona [7]

Answer:

It's been so good to have you as a friend:

2. As sweet and rich as honey-colored sun

3. Slanting steep across a summer lawn,

4. Gilding life with all that love can lend.

5. And now that you yourself have griefs to tend,

6. I want to be the strong and caring one

7. To count to you the lovely things you've done

8. Until these troubles pass and sorrows end.

9. You are so beautiful in form and soul

10. That you bring happiness to all you're near:

11. Just as a sea rose, flowering in mist,

12. Makes a paradise of some bleak shoal,

13. Turning truth to something far more clear,

14. No pain unsoothed or rain-swept cheek unkissed.

good~0~as_a_friend . good_to_have~Slanting~lawn .

It's_been~so_good~as_a_friend .

to_have~griefs_to~form_and_soul

Explanation:

7 0
2 years ago
Which Call of Duty game is the best?
love history [14]

Answer:

i like ghost and modern 3

Explanation:

3 0
3 years ago
Write a loop that fills a list values with ten random numbers between 1 and 100. Write code for two nested loops that fill value
Alex787 [66]

Answer:

Please look for your answer on Stack Overflow, it's way better.

Explanation:

4 0
2 years ago
6.5 Code Practice
o-na [289]

Answer: tried using stack over flow and GitHub. The have most of the codes for everything

Explanation:

4 0
3 years ago
Other questions:
  • Why won't my laptop charge?
    6·1 answer
  • Universal Containers has a requirement to integrate Salesforce with an external system to control record access. What option sho
    11·1 answer
  • Which of the following TCP/IP settings should be configured to specify DNS suffixes to use other than resolving names through a
    9·1 answer
  • (1) Create three files to submit:
    8·1 answer
  • A network administrator for a small company is contemplating how to scale the network over the next three years to accommodate p
    13·1 answer
  • What led to fall of axum?
    15·2 answers
  • Return a version of the given string, where for every star (*) in the string the star and the chars immediately to its left and
    11·1 answer
  • A ________ is an input device that responds to finger touch.
    8·2 answers
  • A(n) _____ is created using the select and option elements that present users with a group of predefined possible values for the
    10·1 answer
  • Armando is trying to decide how he will alert players that the game is over in the new video game that he is designing. He is co
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!