scratch <===> python guessing number
import random mn = 1 mx = 1000 times = 0 ans = random.randint(mn,mx) a = int(input("Choose a number from " + str(mn) + " to " + str(mx))) while True: if a > ans: mx = a - 1 a = int(input(str(a) + " is too big, please choose from " + str(mn) + " to " + str(mx))) times += 1 if a < ans: mn = a + 1 a = int(input(str(a) + " is too small, please choose again from " + str(mn) + " to " + str(mx))) times += 1 if a == ans: times += 1 break if times <= 5: if times == 1: print("Bravo! You guessed once only!") else: if times == 2: print("Wow! You guessed twice only!") else: print("Great! You guessed " + str(times) + " times only!") else: print("You did it! You guessed " + str(times) + " times only!")