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
Name the written test a potential driver must pass
Oliga [24]
In order to obtain a learners permit, teen drivers are required to pass a written test. Typically they will prepare for this exam by completing a drivers education course. Though not a requirement in all states, drivers ed is the easiest way to be thoroughly prepared for the complicated driving laws and scenarios you’ll face on the permit exam. Once you pass your permit test and earn a permit, there may still be certain restrictions attached to this provisional license — such as requiring a licensed driver over a certain age to be seated in the passenger seat, limiting your driving to daylight hours, and other state-mandated rules.
General United States Permit Requirements
While each state has its own set of guidelines, in general, teens between 14 and 18 years of age can start the drivers education and learners permit process. Once a teen driver has obtained a learners permit, there are additional state-specific requirements they must meet before they can apply for their drivers license.
Before obtaining a learners permit in any state, a teenager is required to pass a driving knowledge test. Drivers education is the best way for a teen to prepare for this exam, whether the state requires it or not. In some cases, passing a drivers ed final exam can substitute for the written exam. No matter how the test is taken, students must pass with at least a 70% or higher, depending on that state’s minimum. Once he or she passes, a teen driver will be issued a learners permit. Some states require teen drivers to have a permit for a minimum of 6 months before they can take their drivers license exam.

hope this helped :)
alisa202
7 0
3 years ago
type the correct answer in the Box spell the words correctly Caleb is working on a simple logic base program to stimulate the ga
ycow [4]

Answer:incomplete question

Explanation:

4 0
3 years ago
Read 2 more answers
A software engineer with a detail oriented personality has the patience and aptitude for
AnnZ [28]

Answer is: looking through many lines of code for errors that cause bugs



Explanation:

A software engineer with a detail oriented personality has the patience and aptitude for  looking through many lines of code for errors that cause bugs


Because software writes many lines of code for developing different application so he has to go through through many lines of code for errors that causes a bug or errors.

I hope you got the idea and answer thanks.

5 0
3 years ago
KM typically means the same thing across different types of businesses.
Gennadij [26K]

Answer:

If this is a true or false question, I believe the answer is the answer is false

Explanation:

3 0
3 years ago
Read 2 more answers
Can you change your username? on this app.
qwelly [4]
I made a new account so yeah
8 0
3 years ago
Read 2 more answers
Other questions:
  • You are in a library to gather information from secondary sources, and you want to find a current print resource that can supple
    6·1 answer
  • Ella has finished drafting her presentation. What should she do next?
    6·2 answers
  • **PLEASE HELP**
    12·1 answer
  • All of the Internet in your country disappears. What happens next?
    13·1 answer
  • Whats the best way to get into a computers programming to get past firewalls
    15·2 answers
  • What type of system is associated with weather that has lots of clouds and thunderstorms with the possibility of tornadoes?
    10·1 answer
  • A.
    11·1 answer
  • MULTI-SELECT
    9·2 answers
  • Viết thuật toán và chương trình: Tính tổng:<br> S=1+2+...i
    8·1 answer
  • Find H.C.F of 4,5,10 by all the three methods.​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!