subject
Computers and Technology, 11.10.2021 14:00 dubouuu

PLEASE HELP BRAINLIEST EASY FOR PEOPLE WHO CODE WILL GIVE BRAINLIEST PLEASE I AM STUCK NEED HELP Part 1: Review the Code

Review the code and locate the comments with missing lines (# Fill in missing code).

On the surface this program seems simple. Allow the player to keep guessing until he/she finds the secret number. But stop and think for a moment. You need a loop to keep running until the player gets the right answer.

Some things to think about as you write your loop:

• The loop will only run if the comparison is true.

(e. g., 1 < 0 would not run as it is false but 5 != 10 would run as it is true)

• What variables will you need to compare?

• What comparison operator will you need to use?

# 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 low.")

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

main()

Output

Your guessed 10. Too high.

Your guessed 1. Too low.

Your guessed 3. Too low.

Good job, Jax! You guessed my number (5) in 3 tries!

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:30, 1232444553
Which of the following examples has four beats in each measure?
Answers: 2
image
Computers and Technology, 23.06.2019 20:10, banna01man
Leo is a recruitment executive for a large company. he has identified new labor resource requirements in both the marketing and production departments. what should be his first step in recruiting candidates for the positions? a. conduct background checks of candidates b. make job offers c. arrange interviews d. conduct reference checks e. place job ads on job sites
Answers: 1
image
Computers and Technology, 24.06.2019 10:10, nakeytrag
Which view in a presentation program displays a split window showing the slide in the upper half and a blank space in the lower half?
Answers: 1
image
Computers and Technology, 25.06.2019 08:10, ruslffdr
Memory aids that organize information for encoding are
Answers: 3
You know the right answer?
PLEASE HELP BRAINLIEST EASY FOR PEOPLE WHO CODE WILL GIVE BRAINLIEST PLEASE I AM STUCK NEED HELP P...

Questions in other subjects:

Konu
Mathematics, 19.12.2019 07:31
Konu
Mathematics, 19.12.2019 07:31
Konu
Mathematics, 19.12.2019 07:31