Answer:
import random
arr=[]
for i in range(50):
arr.append(i)
for j in range(5):
answer=random.choice(arr)
guess=int(input("enter your guess number between 0-50: "))
if answer is guess:
print("right guess\ncongratulations.....")
print("the answer was: "+str(answer))
break
elif guess < answer-10:
print("you guessed too low....\ntry again")
print("the answer was: "+str(answer))
elif guess > answer+10:
print("you guessed too high....\ntry again")
print("the answer was: "+str(answer))
else:
print("incorrect guess\ntry again")
print("the answer was: "+str(answer))
Explanation:
the code is in Python programming language.