Question: Examine the code written below. This program when running correctly will generate a random number between 1 and 1 0 0 and then ask the

Examine the code written below. This program when running correctly will generate a random number between 1 and 100 and then ask the user to guess it. The user will have 7 chances to guess the number. With each guess the program will give the user hints. The user can play the game multiple times. When the user guesses correctly the program will print out "You Win!". If the user guesses incorrectly the program will display "You Lose!".
Copy and paste the code into either IDLE or VS Code. Identify the five errors within this file by inserting comments in your code. After you have identified the bugs and fixed the code, upload it here to this question.
#Variables
guess = int()
randomNum = int()
chances = int()
UserContinue = str()
#Generate the random number
while UserContinue = "yes":
randomNum = random.randint(1,100)
guess = int(input("Enter your guess ==>"))
while chances <=6:
if guess == randomNum:
print("You Win!")
chances =8
elif guess < randomNum:
print("Your guess is higher than the chosen number.")
guess = int(input("Please enter another number ==>"))
chances = chances +1
else:
print("your guess is lower than the chosen number.")
guess = int(input("Please enter another number ==>"))
chances = chances +1
#end if
#end loop
#Ask the user if they want to continue
UserContinue = input("Do you want to play again? Enter yes or no ==>")
#End loop

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!