Write a program that has a user guess a secret number between 1 and 10. Store the secret number in a variable called secretNumber 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:_______.

Answers

Answer 1

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")


Related Questions

What email program would you suggest and why?

Answers

Answer:

An email program

Explanation:

And why?

Answer:

I would suggest g m a i l.

Explanation:

I use G m a i l all the time and I think it is easy to use! A lot of people think it is great too! :)

Identify the correct characteristics of Python lists. Check all that apply. Python lists are enclosed in curly braces { }. Python lists contain items separated by commas. Python lists are versatile Python data types. Python lists may use single quotes, double quotes, or no quotes.

Answers

Answer:

Python lists contain items separated by commas.

Python lists are versatile Python data types.

Python lists may uses single quotes, double quotes, or no quotes.

Explanation:

Python Lists are enclosed in regular brackets [ ], not curly brackets { }, so this is not a correct characteristic.

Answer:

a c d

Explanation:

How to do brainliest

Answers

If the reply that someone put has a blue crown you click it and it will give them brainliest but it usually won’t work unless there are two answers

What effect would excluding quotation marks from a search phrase have?
A.
It would narrow down the search.
B.
It would have little or no impact on the search.
C.
It would broaden the search.
D.
It would cause the search engine to bring up very different results.

Answers

Answer: C

 it would broaden the search

Explanation:

Placing quotation marks around a search term or phrase limits your search to that exact term or phrase. Without the quotes, your search engine may return all results that contain each separate word. Placing AND between your keywords will return results that only include both or all your keywords.

Answer:

The answer is C. It would broaden the search.

Explanation:

I got it right on the Edmentum test.

Write a program that reads an integer between o and 1000 and adds all the digits in the integer. For example, if an integer is 932, the sum of all the digits is 14. Hint: Use the % operator to extract digits, and use the / operator to remove the extracted digit. For instance, 932 % 10=2 and 932/10 =93. Here is a sample run:
Enter a number between 0 and 1000 : 999
The sum of digits is 27.

Answers

Answer:

Answered below

Explanation:

#Program is written in Python programming language

digit = 0

sum = 0

num = int(input("Enter a number between 0 and 1000: ")

#Check that number is within the valid range

if num > 0 and num <= 1000:

while num != 0:

#Isolate each digit

digit = num % 10

sum = sum + digit

#Remove isolated digit from number

num = num/10

else:

print("Number is not within valid range")

#print total sum of digits

print(sum)

Gamification and virtual reality is the future of education

Answers

Answer:

Education is expected to be the fourth largest sector for VR investment. VR in education is predicted to be a $200 million industry by 2020, and a $700 million industry by 2025. 97% of students would like to study a VR course.

Explanation:

/* missing precondition */

public String getChar(String str, int n) {

return str.substring(n, n 1); }

Write down the most appropriate precondition for the method so that it does not throw an exception.

Answers

Answer:

An appropriate precondition is:

0 <= n && n <= str.length() - 1

Explanation:

Required:

Write down an appropriate pre-condition for the program

From the question, we understand that the method accepts two parameters:

str -> A string value

n -> An integer value which represents the index of character to return from the string str

It should be noted that:

n must be within the range of 0 and str.length()-1

Take for instance:

str = "ABCDE";

n must be within the range 0 to 4 (inclusive) in order not to raise an exception. This is so because the string index starts at 0 and stops at 1 less than the length of the string.

Hence, the precondition can be written as:

0 <= n && n <= str.length() - 1

Which means: n = 0 to length - 1

Other Questions
define immunology?please answer this question Is this equation proportional? why?y = 3x + 2x Solve the system of linear equations by elimination. 10x-9y=46 and -2x+3y=10 Which statement is incorrect in regard to studying Rome?Group of answer choicesThere is plenty of fabrication.Romans embellished their past.The study of Roman history is simple given the fact that there are balanced accounts.There are no public documents. Editing and revising are part of the writing process. In 3-4 sentences, describe the difference between the two. Jacinta is learning about the chemicals involved in breathing. Oxygen gas, water vapor, and carbon dioxide are all compounds formed by the chemical reactions between nonmetal elements. Which statement can Jacinta correctly make about the chemical properties of nonmetals? A. Many nonmetals react with both metals and nonmetals. B. Nonmetals are poor conductors of heat and electricity. C. Many nonmetals are gases at room temperature. D. Nonmetals react only with other nonmetals. In the figure below, what are the lengths of a, b, and c? Round answers to nearest tenth. You might need:CalculatorThe lifespans of lizards in a particular zoo are normally distributed. The average lizard lives 3.1 years, thestandard deviation is 0.6 years.Use the empirical rule (68 - 95 - 99.7%) to estimate the probability of a lizard living between 2.5 and4.3 years.1%Show CalculatorReport a problemPlz HELP!!! so I really need help. you have to set fractions equal to each other and try and find out how many prefer sweaters and whatnot. Also, the answer isn't supposed to be a fraction, it's supposed to be a whole number, you find the answer by using fractions with the information provided in the word problem above ^I hope that makes sense. lol, thank you :) Siddhartha Gautama created an order of what, to help him work with his followers?a.priestsc.chaplainsb.monksd.shaman tell me how to answer this please I WILL MARK BRAINLIEST If it costs $1.40 per square foot to install the garden, what is the cost for plan A? Plan B? Which form, of plan of federal government suggested greater power for the states?A) Virginia plan B) New Jersey plan C) legislature need help asap please what is 1+1 please help A parallel circuit contains four identical lamps. The current through the energy source is 4 A. The total resistance of the circuit is 10 . What is the voltage across the energy source and across each lamp What causes a raindrop tochange shape?A.the ground that it lands onB.the air that pushes against itC.the cloud that it falls from (BRAINLIEST) and more in the description.Confession: I suck at math lol......Description and benefits: The person with the correct answer will be given 30 points, brainliest, five-star rating, and a thanks. If you answer incorrectly just to get rewards you will be reported to Brainly and your answer will be deleted to give someone else a chance. I need help with #15 please and thanks. Writing a descriptionDescribe a journey by bus as suggested by this picture[40 marks]