Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Having an issue with this code and can't figure out why its telling me the number I need to guess. take a look at the
Having an issue with this code and can't figure out why its telling me the number I need to guess. take a look at the output, after the 2 attempt, the programs tells me the # i need to guess even if I get it wrong.
FIPRO ErC Assignment 8B Guessing game.py - C:/Users/Icand/Documents/Valencia College/Spring Semester 2021/Intro to Progra... File Edit Format Run Options Window Help La 7 10 11 12 13 14 15 16 17 # import random module import random #generate random number from 1 to 100 num = random.randint (1,100) 18 #print welcome message print ("Welcome to the number guessing game!!") print("You will have 10 tries to guess a secret number between 1 and 100") SC #define tries and no_of_count tries = 1 no_of_count =1 OC #prompt user to enter guess print(("Enter your guess () of 10: "). format (no_of_count)) user_input = int (input()) #define while loop which runs till tries is less than 10 and user_input not equal to num while(tries100): user_input = int(input ("The guess is out of range. Please enter the guess again: ")) #if player guess more than number if user_input>num: print ("You guessed too high, please guess lower") #if player guess less than number elif user_inputStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started