answer.
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
Cloud [144]
2 years ago
7

You wrote a program to allow the user to guess a number. Complete the code.

Computers and Technology
1 answer:
fiasKO [112]2 years ago
7 0

Answer:

The complete program is as follows:

keepGoing = True

attempts = 0

correct = 2

while keepGoing:

    guess = input("Guess an integer from 1 to 10: ")

    guess = int(guess)

    attempts = attempts + 1

    if guess == correct:

         print("You were correct!")

         keepGoing = False

    elif guess < correct:

         print("Guess higher.")

    else:

         print("Guess lower. ")

Explanation:

This line initializes keepGoing to true

keepGoing = True

This initializes number of attempts to 0

attempts = 0

This initializes the correct guess to 2 (you can also use any number)

correct = 2

The following iteration is repeated until the number is guessed correctly

while keepGoing:

    guess = input("Guess an integer from 1 to 10: ")

    guess = int(guess)

    attempts = attempts + 1

    if guess == correct:

         print("You were correct!")

If user guess is correct, keepGoing is set to False

         keepGoing = False

    elif guess < correct:

         print("Guess higher.")

    else:

         print("Guess lower. ")

You might be interested in
Which act was used to penalize Sara? Sara was found to be in possession of a controlled substance for which she had no justifica
andre [41]
<span>si la sustancia es droga, cárcel</span>
6 0
2 years ago
c++ You are given an array A representing heights of students. All the students are asked to stand in rows. The students arrive
Lilit [14]

The below code will help you to solve the given problem and you can execute and cross verify with sample input and output.

#include<stdio.h>

#include<string.h>

 int* uniqueValue(int input1,int input2[])

 {

   int left, current;

   static int arr[4] = {0};

   int i      = 0;

     for(i=0;i<input1;i++)

      {

         current = input2[i];

         left    = 0;

         if(current > 0)

         left    = arr[(current-1)];

      if(left == 0 && arr[current] == 0)

       {

       arr[current] = input1-current;

       }

       else

   {

       for(int j=(i+1);j<input1;j++)

       {

           if(arr[j] == 0)

           {

               left = arr[(j-1)];

               arr[j] = left - 1;

           }

       }

   }

}

return arr;

}

4 0
2 years ago
in a blank excel workbook go to insert tab on the ribbon, which of the following is Not vailable 1 smart art 2 coloumns ( not co
Anuta_ua [19.1K]

Answer:

  1. hahahahahahahhahah
7 0
2 years ago
Which security control is most helpful in protecting against eavesdropping on wireless LAN (WLAN) data transmissions that would
3241004551 [841]

Answer:

D. Applying strong encryption

Explanation:

Strong cryptography or cryptographic-ally strong are general terms applied to cryptographic systems or components that are considered highly resistant to cryptanalysis.One cryptographic cipher has been mathematically proven to be unbreakable when it is used correctly, but it is only very rarely used.

6 0
2 years ago
On a DTP project, Morgan is preparing digital files to be sent to a printer. Which word describes the activity that Morgan is pe
VladimirAG [237]

In this activity Morgan is preparing the digital files to a printer  on a DTP project.

Explanation:

DTP project is the creation of documents using page layout on a personal computer. The process of printing digital based images directly to variety of media substrates is known as digital processing.

The digital files like PDFs can be sent directly to digital printing press to print on paper, photo paper, fabric and so on.

They have unique fade rates and different sensitives to the various deterioration mechanisms. DTP is used for graphic designers to create documents.

6 0
2 years ago
Read 2 more answers
Other questions:
  • how do you make a circuit so 1 switch will turn on/off all the lights(3 lights) and a second switch will change the lights from
    14·2 answers
  • Currently, there are two major techniques used to develop programs and their procedures. name and describe them. html editor key
    11·1 answer
  • Python comes with ________ functions that have been already prewritten for the programmer.
    5·1 answer
  • Following are groups of three​ phrases, which group states three ways to improve your​ concentration?
    13·1 answer
  • How many frequencies does a full-duplex qam-64 modem use?
    8·2 answers
  • Write a C++ program that prompt the user to enter three points (x1, y1), (x2, y2), (x3,y3) of a triangle and displays its area.
    15·1 answer
  • Which use case can be accomplished using a custom link? Choose 3 ans A. Navigate to a process to update the current record. B. N
    10·1 answer
  • All of the following are specific security challenges that threaten corporate systems in a client/server environment except:
    14·1 answer
  • C++
    8·1 answer
  • To create a public key signature, you would use the ______ key.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!