subject

Output: Your goal  You will complete a program that asks a user to guess a number.  
 
 
Part 1: Review the Code 
Review the code and locate the comments with missing lines (# Fill in missing code). Copy and paste the code into the Python IDLE. Use the IDLE to fill in the missing lines of 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 linesdef 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 tookmain() 
 
Part 2: Test Your Code  
1Use the Python IDLE to test the program. 
2Using comments, type a heading that includes your name, today’s date, and a short description. 
3Run your program to ensure it is working properly. Fix any errors you observe. 
Example of expected output: The output below is an example of the output from the Guess the Number game. Your specific results will vary based on the input you enter. 
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! 
  
When you've completed filling in your program code, save your work by selecting 'Save' in the Python IDLE. 
When you submit your assignment, you will attach this Python file separately.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:30
Write a program that reads the file, then displays the average number of steps taken for each month. (the data is from a year that was not a leap year, so february has 28 days.) your program needs to use at least 3 functions not counting main and display the information in a neat well formatted fashion.
Answers: 3
question
Computers and Technology, 22.06.2019 17:40
Gabe wants to move text from one document to another document. he should copy the text, paste the text, and open the new document highlight the text, select the cut command, move to the new document, make sure the cursor is in the correct location, and select the paste command select the save as command, navigate to the new document, and click save highlight the text, open the new document, and press ctrl and v
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
1. which of the following statements are true about routers and routing on the internet. choose two answers. a. protocols ensure that a single path between two computers is established before sending packets over it. b. routers are hierarchical and the "root" router is responsible for communicating to sub-routers the best paths for them to route internet traffic. c. a packet traveling between two computers on the internet may be rerouted many times along the way or even lost or "dropped". d. routers act independently and route packets as they see fit.
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
The camera still is bad even with the new iphone xr and especially in low light it is even worst because you can see the pixels more if its in low light. if all you apple customers want apple to fix this then lets fill there feedback with complaints about the can apple do to fix this issue?
Answers: 1
You know the right answer?
Output: Your goal  You will complete a program that asks a user to guess a number.  
 
 
Questions
question
Physics, 03.07.2021 01:00
question
Mathematics, 03.07.2021 01:00
Questions on the website: 13722367