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
Cloud [144]
3 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]3 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
After you save a table, the new table name appears ____.
kobusy [5.1K]
Table1/2.....hope it helps
5 0
3 years ago
Read 2 more answers
Piers lives in an apartment and has an existing home television connection. He wants to subscribe to a high-speed internet conne
lina2011 [118]

Answer:

D. Wireless Network

Explanation:

A Wireless network has no need for cabling, trunking nor any heavy device installation. a Portable wireless device can solve his problem.

5 0
3 years ago
A technician is troubleshooting a computer that will not communicate with any hosts on the local network. While performing a vis
tangare [24]

Answer:

Assuming that D is correct, the other answer is C.

Explanation:

<em>I used Dell Support to confirm this.</em>

It states that if the lights are off, it is not detecting the network and no connection is in place. You would want to confirm the NIC is enabled in the BIOS (as C states).

I hope this helps!

8 0
3 years ago
How does the browser display the same webpage whether you enter the URL or the IP address in the address bar? What system transl
ASHA 777 [7]
Your browser references a DNS server that translates a word or phrase of a url into an IP and then tells your browser what the IP address is so the browser can navigate to it. My google is not working atm sorry but you can google "what does DNS stand forin networking" and get an answer.
8 0
4 years ago
What makes for a good algorithm compatibility complexity humor correctness efficiency?
Svetlanka [38]
Correctness is key. The other ones are optimizations at most. Although I would always include humor... ;-)
5 0
4 years ago
Other questions:
  • When sending a packet of data from source host to a destination host over a fixed route. Which of the delay components are varia
    8·1 answer
  • Which of the following actions should you take when turning left at an intersection?
    11·1 answer
  • To provide both encryption and integrity protection, wpa2 uses aes encryption with:
    12·1 answer
  • What vi command do you use to insert the a file named "file2.txt" to the end of your current file?
    12·1 answer
  • Create a script that will find the sum of the all multiples of 3 between 1 and 1000 by using For Loop. (Pseudo Code required) 3.
    7·1 answer
  • Jack is going for a safari. Which camera should he take with him and why?
    6·1 answer
  • __________ intelligence is an approach to boundary spanning which results from using sophisticated software to search through in
    15·1 answer
  • Write a program that prompts the user to enter a number then counts the number of odd numbers and even numbers the user enter. T
    15·1 answer
  • Why were Redditors interested in "Mister Splashy Pants"?
    6·2 answers
  • General Electric saves $1.6 billion per year by using its private corporate network that links its 340,000 employees. Another na
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!