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
Identify the data set level of measurement for the following: individual tax filing status (single, head of household, widowed,
Snowcat [4.5K]

Answer:

Option (B) Nominal is the correct option.

Explanation:

Nominal data set is the set of the heights of data measurement for the particular tax filing status. It also used for the labeling of the variables without allowing them to the quantitative data type. So, that's why the following option is correct.

Other options are wrong because the following statement is related to the Nominal data set.

6 0
3 years ago
Write a program that allows the user to play a guessing game. The game will choose a "secret number", a positive integer less th
Burka [1]

Answer:

// This program is written in C++

// Comments are used for explanatory purpose

// Program starts here

#include<iostream.h>

#include<stdlib.h>

int main()

{

// Declare variables

int num, selectno;

string status;

randomize();

//Generate random number;

num=rand()%10000;

// Prompt to guess a number

cout<<"You have only 10 tries\nTake a guess: ";

int tries = 0;

while (tries != 10)

{

cin>>selectno;

if(selectno == num){

cout<<"You passed at the "<<count+1<<" attempt";

tries = 10;

}

else

{

cout<<"You failed. Take another guess\n You have "<<10 - count + 1 <<" attempts";

}

tries++;

if(tries >= 10)

{

break;

}

}

return 0;

}

8 0
3 years ago
If a wire has insulation that allows it to operate in a temperature of up to 194 degrees Fahrenheit, what temperature will the w
zzz [600]
(194°F-32)×5/9
= 90°C
therefore the answer is 90degrees Celcius
6 0
3 years ago
Canada’s energy plan, named __________, makes three governmental agencies accountable for safeguarding Canada’s environment.
stepan [7]

Answer:

Canada launched the national Generation Energy Council of leading Canadians, who proposed principles to the Government of Canada on how to build our energy future. Today, these principles guide government decisions to support Canadian families, businesses, and communities. Together, we are: saving energy powering clean communities.

Explanation:

8 0
2 years ago
What number is needed to complete the pattern 66, 73, 13, 21, 52,_, 10, 20?
Lilit [14]
66,73 73-66=7
13,21 21-13=8
10,20 20-10=10

the missing no. is 9 so
52+9=61.

the pattern is
66,73,13,21,52,61,10,20





8 0
3 years ago
Other questions:
  • 1. What are the biggest risks when using the public Internet as a Wide Area Network (WAN) or transport for remote access to your
    6·1 answer
  • Differences between electromechanical era and electronic era in point.<br>PLZ HELP​
    6·1 answer
  • Hurry answerrrrrrr pleaseee
    11·2 answers
  • Communication of a message between two processes implies which of the following? (A) Synchronization (B) Atomic operation (C) Bl
    11·1 answer
  • Arctic Gear LLC. recently adopted a new ERP​ system, but quickly found that it​ wasn't a perfect fit with their existing procedu
    14·1 answer
  • Suppose your name was George Gershwin. Write a complete main method that would print your last name, followed by a comma, follow
    9·1 answer
  • Complete the sentence.<br> A ___ number is composed of only zeros and ones.
    8·1 answer
  • Not every organization integrates with the Internet, but all use some or most of the technology that gave rise to it.
    15·1 answer
  • Which devices are used in networking
    15·1 answer
  • Question 1
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!