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
lina2011 [118]
3 years ago
10

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

r and allow the user to continually input numbers until they correctly guess what secretNumber is. Complete the method guessMyNumber that uses a while loop to ask the user for their guess and compares it againist secretNumber. For example, if secretNumber was 6, an example run of the program may look like this:_______.
Computers and Technology
1 answer:
Tom [10]3 years ago
5 0

Answer:

Explanation:

The following code is written in Python. It is a function called guessMyNumber and like requested creates a random number and saves it to secretNumber. Then it continuously asks the user for their guess and compares it to the secret number. If the guess is correct it exits the loop otherwise it will continue to ask for a new guess.

import random

def guessMyNumber():

   secretNumber = random.randint(1, 10)

   print(secretNumber)

   while True:

       guess = input("Enter your guess: ")

       guess = int(guess)

       if (guess == secretNumber):

           print("Congratulations you guessed correctly")

You might be interested in
Unleashes the ability of each person on their team to improve performance, solve problems, and
lisabon 2012 [21]

Answer:

A coach

Explanation:

It fits the question

4 0
3 years ago
Read 2 more answers
Cobbling together elements from the previous definition and whittling away the unnecessary bits leaves us with the following def
pentagon [3]

Answer:

This is not plagiarism

Explanation:

The student has properly referenced the original source material, therefore, it is not plagiarism. Also, it is sufficient to just reference the attached source material author. Although it is implied that several other authors' material has been used in the source material, there is no need for the student to reference the other authors too.

3 0
2 years ago
A musical time measurer is a(an)
Radda [10]
A musical timer is a metronome.
3 0
2 years ago
What are some good digital habits?
kkurt [141]

ANSWER

1. Turn off all the notifications.

2. Set your phone to black and white.

5 0
2 years ago
Read 2 more answers
Maggie is preparing a business report. Which types of keys will she use to type out words and numbers?
nadya68 [22]
She would use enter period comma backspace
Hope this helps u
6 0
2 years ago
Read 2 more answers
Other questions:
  • Which type of hypervisor does not run on an underlying operating system?
    13·1 answer
  • You are a network security administrator for a bank and you have noticed that an attacker has exploited a flaw in OpenSSL and fo
    9·1 answer
  • People using commercially available software are usually asked to read and agree to a(n) _____
    10·1 answer
  • When installing EMT conduit that will be exposed to wet conditions, _______ fittings should be used.
    5·2 answers
  • Write a program to create a customer bill for a company. The company sells only five products: TV, DVD player, Remote Controller
    12·1 answer
  • Here is a list of storage devices:
    5·1 answer
  • The template code provided is intended to check whether an integer entered by the user is outside of the range 20-29 (inclusive)
    9·1 answer
  • What is Celeste? ( This is for my coding class )
    6·2 answers
  • In python, Create a conditional expression that evaluates to string "negative" if user_val is less than 0, and "non-negative" ot
    12·1 answer
  • Guys, please help me asap (Photo Attached) !!!!!!! HELP 25pts!!!!
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!