Respuesta :

fichoh

The implementation of the guessing game ls written in python 3 which involves a maximum guess of 7 to make a prediction of the random integer generated.

import random

#import the random module for generating random numbers

num = random.randint(0, 100)

#generate a random integer value between 1 to 100 and store in the variable num

tries = 0

#initialize a counter to record the number of guesses made

while tries <7 :

#while loop ensures that only a maximum of 7 guesses is are made

guess = int(input('Enter your guess'))

#prompts user to make a guess

tries+=1

#increases the number of guesses by 1

if guess == num :

#checks if the guess is equal to the random number

print('success')

#dispaly success if true

elif tries < 7 :

#if not check if number of guesses is not up to 7 and tell user to try again

print('Try again')

elif tries == 7 :

#checks if number of tries is equal to 7

print('tries exceeded\n the random number is :', num)

# tell user that is number of tries has elapsed and display the correct number.

A sample run of the program and the output is attached.

Learn more :https://brainly.com/question/19347842

Ver imagen fichoh