pls answer this fellow coders i need it so bad



# Heading (name, date, and short description) feel free to use multiple lines


def main():


# Initialize variables

numGuesses = 0

userGuess = -1

secretNum = 5


name = input("Hello! What is your name?")


# Fill in the missing LOOP here.

# This loop will need run until the player has guessed the secret number.


userGuess = int(input("Guess a number between 1 and 20: "))


numGuesses = numGuesses + 1


if (userGuess secretNum):

print("You guessed " + str(userGuess) + ". Too high.")


# Fill in missing PRINT statement here.

# Print a single message telling the player:

# That he/she guessed the secret number

# What the secret number was

# How many guesses it took


fill in the missing code

Answers

Answer 1

This is how I would do it using the main function:

def main():

   num_guesses = 0

   secret_num = 5

   name = input("Hello! What is your name? ")

   while True:

       user_guess = int(input("Guess a number between 1 and 20: "))

       if user_guess == secret_num:

           num_guesses += 1

           break

       elif user_guess < secret_num:

           num_guesses += 1

           print("You guessed {}. That was too low!".format(user_guess))

       elif user_guess > secret_num:

           num_guesses += 1

           print("You guessed {}. That was too high!".format(user_guess))

   print("The secret number was {}. You guessed it correctly in {} tries".format(secret_num, num_guesses))

if __name__ == "__main__":

   main()

I hope this helps!


Related Questions

To generate integers between and including -10 to 10 you would use:

Answers

I’m pretty sure you would use multiplication don’t get mad if I’m wrong
I think multiplication

is this a scam pls tell me????????????/

Answers

Yes don't trust at all, I've got that so many times

Oh lord yes it is a huge scam

Joe finished writing his final English paper and completed the proofreading and updates. He wants to read through his paper one final time but wants to make sure he doesn't accidentally make any changes. What view should Joe use?
Editing View
Immersive View
Proofreading View
Reading View

Answers

Answer:

reading view

Explanation:

cause all others will inflict change

Answer:immersive view

Explanation:if he’s really focused on it he won’t make and more edit mistakes

This answer is wrong I’m sorry

A=3
b = 2
print (a ** b)
What is output?

Answers

Answer:
9
Explanation:
3^2

6. The ink pen was dropped by her parent. Change this sentence to active voice. *

Answers

Answer: g what are you talking ab

Explanation:

"Her parent dropped the ink pen." would be the active voice of this sentence

If you know tags please help me. explain what each do?

Answers

Answer:

The <html> tag is the container for all other HTML elements (except for the <! DOCTYPE> tag). Note: You should always include the lang attribute inside the <html> tag, to declare the language of the Web page.

The <head> tag contains metadata (document title, character set, styles, links, scripts), specific information about the web page that is not displayed to the user. Metadata provides browsers and search engines with technical information about the web page

Doctype informs the web browser about the type and version of HTML used in building the web document. This helps the browser to handle and load it properly

The <body> tag defines the document's body. The <body> element contains all the contents of an HTML document, such as headings, paragraphs, images, hyperlinks, tables, lists, etc. Note: There can only be one <body> element in an HTML document.

Explanation: I got most of this from Google... Hehe

^^ gave u the answer I was about to type the same thing lol

PLEASE HELP ME ASP!!!
A switch joins devices on the same network so they can communicate.

True

False

Answers

Answer:

It is true

Explanation:

Because it is communicating so the switch gets energy

This is True...................
Other Questions
List the causes of American involvement in the Afghan War. Do you believe it was worth American involvement in the War? Reyes manufacturing company uses a job order cost system. at the beginning of january, the company had one job in process (job 201) and one job completed but not yet sold (job 200). job 202 was started during january. other select account balances follow (ignore any accounts that are not listed). How should civil rights be enforced and protected? Why are the pyramids considered an important architectural achievement for the ancient Egyptians? A. The pyramids were a place of worship for the Egyptian citizens. B. The pyramids led to the development of hieroglyphic writing. C. The pyramids were the basis for agriculture in ancient Egypt. D. The pyramids were built using extremely precise measurements. One tank is filling at a rate of 5/8 gallon per 7/10 hour. What is the unit rate per hour? |x |-8= -5 what's the answer Steve earns $10.50 an hour working in a store. Last weekendhe earned a total of $73.50. Which equation can be used tofind n, the number of hours Steve worked last weekend? Mresceboeinl Rearrange the words Based on what you know about Georgias regions; why would the Appalachian Plateau be the least populated? what is history ? ?????? Can someone help me answer these please? What is the equation of the line that passes through the point (1,0) and has a slopeof 1? What is the value of 11,340 divided by 27 What is the main belief that distinguished the Jewish faith from the others in the ancient world?Group of answer choicesthe worship of a single god rather than many godsthe belief in life after deaththe organization of belivers into a separate statethe offering of sacrifices during religious ceremonies Which of the following was the greatest short-term effect of Spanish colonization on American Indiansthis is global studies SOSwhich of the following were artistic achievements of the Chinese!!!!A. Silk weave, poetry, and jade carvingB. Jade carving, paper making, and wheel burrowC. Acupuncture, rudder , and bronze workingD. Architecture, acupuncture and poetry Brandon and his two friends went out for dinner. They plan to split the bill evenly, and plan to leave a 18% tip. The bill is $54.98 before the tip. Which is the closest to the amount each person will pay for the meal, including the tip?A) $21.63B) $32.44C) $9.90D) $18.33 1. Write a function named problem1 to simulate the purchases in a grocery store. Write statements to read the price of each item until you enter a terminal value to end the loop. Calculate the subtotal and add a sales tax of 8.75% to the subtotal. Return the subtotal, the amount of the sales tax, and the total. Call the function and display the return results. (25 pts) For something to be considereddead, it used to do what? Nilda has $25 in her savings account. She plans to save 6.50 per week from her salary. Iona has $50 in her account but can save $13 per week from her paycheck. Nilda gets paid twice a month, but Iona only gets paid once a month. How many weeks will it take before the amount in each savings account is the same?