Question: 1 #guessing game with 10 guesses 2 import random 3 4 guesses_left=10 5 secret_number=random.randint(1,1000) 6 guess = 0 7 8. while (guesses_left >= 1): 9


1 #guessing game with 10 guesses 2 import random 3 4 guesses_left=10 5 secret_number=random.randint(1,1000) 6 guess = 0 7 8. while (guesses_left >= 1): 9 guess = int(input ("Guess a number between 1 and 1000")) 10 - if (guess secret_number): 13 print("too high") 14 else: 15 print("that is correct!") 16 guesses_left = 1 17 guesses_left = guesses_left -1 18 if (guesses_left == 0): print ("Game Over!") 19 1) In Line 1, what does the # symbol do? 2) In Line 2, what is the purpose of the import random function? 3) What does line 5 do? 4) There are two conditions that end the game, what are they? Which lines of code are they determined to have been met? 5) When does the while loop in line 8 stop executing? 6) Explain why in line 4 and line 18 that one line has one = sign, and the other line has two = signs. 7) Run the program. What was your secret number? 8) On line 20, write code that will print out what the secret number was. Type that one line of code below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
