# 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:
	if y == x: 
		rate = 1.0 / count
		ans = "You WIN! {}回であたった。勝率は{:.2f}。\n"
		print(ans.format(count, rate))
		break
	elif y < x:
		print('私はそれよりも大きいよ!\n') 
		count += 1
	else:
		print('私はそれよりも小さいよ!\n')
		count += 1
	y = int(input('数字入れて: '))
if y <= 0 or y >= 100:
  	raise Exception("\n入力ミス. 1--99の数字を入れること.\n")