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
Aleksandr [31]
3 years ago
14

Write a program that has a user guess a secret number between 1 and 10. Store the secret number in a variable called secret Numb

er and allow the user to continually input numbers until they correctly guess what secretNumber is. For example, if secretNumber was 6, an example run of the program may look like this:
Computers and Technology
1 answer:
Ganezh [65]3 years ago
8 0

Answer:

The program in Python is as follows:

import random

secretNum = random.randint(1,10)

userNum = int(input("Take a guess: "))

while(userNum != secretNum):

    print("Incorrect Guess")

    userNum = int(input("Take a guess: "))

print("You guessed right")

Explanation:

This imports the random module

import random

This generates a secrete number

secretNum = random.randint(1,10)

This prompts the user to take a guess

userNum = int(input("Take a guess: "))

This loop is repeated until the user guess right

while(userNum != secretNum):

    print("Incorrect Guess")

    userNum = int(input("Take a guess: "))

This is executed when the user guesses right

print("You guessed right")

You might be interested in
You share a number of files from your computer, and you've received a number of calls from users who say they can't connect to t
zmey [24]

Answer:

ifconfig p2s1 down ifdown enp2s1 ip link set enp2s1 down

Explanation:

It can be used to enable or disable a network port interface in Linux. It involves 5 methods which are.

A.) ifconfig command. Is adopted in configuring a network interface, it gives info about NIC

B.) ifdown/if up command. Used to bring down or bring up a network interface.

C.) ip command. Used in managing NIC

D.) nmc1i command

It is a line tool that controls network manager and is also used in describing the status of a network.

E.) nmtui command

4 0
3 years ago
What is the output of the following Python statements? def recurse(a): if (a == 0): print(a) else: recurse(a) recurse(0)
FrozenT [24]

Answer:

d) 0 1 1 2

The above piece of code prints the Fibonacci series.

Explanation:

def a(n):

   if n == 0:

       return 0

   elif n == 1:

       return 1

   else:

       return a(n-1)+a(n-2)

for i in range(0,4):

   print(a(i),end=" ")

5 0
3 years ago
When will an on loop condition happen?
rjkz [21]

Answer:

A

Explanation:

because loop always comes in events

3 0
3 years ago
Read 2 more answers
What is the protocol used for the majority of network/internet traffic?
mash [69]
This is rather ambiguous, but in this day an age, it has to be the "internet protocol" (IP). 
7 0
3 years ago
What does Snap do?
Zinaida [17]

Answer:

Snap enables you to resize open windows,

Explanation:

Snap enables you to resize open windows, It is convenient when you want to see two windows simultaneously (side by side).

To do this, drag the desired window the left\right until the cursor reaches to the edge of the screen and then release the mouse.

The window will snap into place.

7 0
3 years ago
Other questions:
  • You have been doing a lot of web surfing lately as part of your research for your course and along the way you have noticed a gr
    14·1 answer
  • Which string method counts the number of characters in a string?
    5·1 answer
  • Several words separated by spaces used in place of a password are called what?
    7·1 answer
  • Why would you use a billeted list in a slide presentation?
    11·1 answer
  • When parallel parking, you should select a space that is __________ as long as your car.
    11·1 answer
  • Ask the user to input an integer. Print out the next three consecutive numbers.
    12·1 answer
  • Which company was the first to develop personal computers?
    6·1 answer
  • A<br>A<br>printount<br>of your report or a till slip is an<br>example of what​
    15·1 answer
  • What formula would you enter in c4 that combines a4 and b4 to get a result like c2
    15·1 answer
  • Provide the user with a menu for the following 10 algorithms. Then ask which algorithm the user decides she/he wants to use. Fin
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!