while(True):
print'1-9?'
if int (raw_input())==random.randint(1,9):
print 'ok'
else:
print'bad'

これで合ってます?