python b2
 # coding: utf-8
import random
import os 

os.system('clear')
print('\n   数あて(1--99) \n')
print('===============================\n')

x = random.randint(1,99)
count = 1
y = int(input('数字入れて: ')) 

while y > 0 and y < 100:#any other number and the pgrm ends like -1 or 1001 etc.
    #0  0 and 100 are also included 
    # python doesn't support '>=' or '<=' only '>' '<'
	if y == x: 
		rate = 1.0 / count
		ans = "You WIN! {}回であたった。勝率は{:.2f}。\n"#{} ==>ukesara ==> is udse for include x variable
  #{} first will have count {} second will have rate
  # {:.2f} or {:.1f} is same as c++ lang %1f or %2f ==> only 1 or 2 digits after decimal.  
		print(ans.format(count, rate))
		break
	elif y < x:
		print('You are smaller than me!\n') 
		count += 1
	else:
		print('You are larger than me!\n')
		count += 1
	y = int(input('数字入れて: '))#くりかえし のため
if y < 0 or y > 100:
  	raise Exception("\n入力ミス. 1--99の数字を入れること.\n")
    
実行結果