Guess the number game

import random
guesses_taken = 0
print(‘Hello! Welcome to guessing game!!!’)
user_name = input(‘What is your name? ‘)
number = random.randint(1, 100)
print(‘Well, ‘ + user_name + ‘, I am thinking of a number between 1 and 100.’)

while guesses_taken < 6:
guess = input(‘Take a guess? ‘)
guess = int(guess)
guesses_taken = guesses_taken + 1
if guess < number:
print(‘Your guess is too low.’)
elif guess > number:
print(‘Your guess is too high.’)
elif guess == number:
guesses_taken = str(guesses_taken)
print(‘Good job, ‘ + user_name + ‘! You guessed my number in ‘ + guesses_taken + ‘ guesses!’)

if guess != number:
number = str(number)
print(‘Nope. The number I was thinking of was ‘ + number)

 

In this I tried to create a short game where user have to guess the number that was randomly chosen by the computer or code. To do this I imported random module .Then I asked user to guess the number and assigned that value to variable called guess. I gave user or player 6 chances to guess the number and if the the guess is too high then computer lets the user know that and same goes for if user gives a guess number below the correct one. This way user can figure out the number and if the user is unable to do, then the computer tell the number at last. I f user guess correctly then computer tells the user how many guess the user took to get the correct answer or number. To do all this I used if,elif and else statement.