```[[問題文>練習問題#ffeaab60]]
from random import *
from random import shuffle
N = 4
a = range(1, 10)
shuffle(a)
a = ''.join(map(str,a[:N]))
x = ''
while x!=a:
hit, blow = 0, 0
x = raw_input('Input %d digit number: ' % N)
for i, e in enumerate(a):
if x[i]==e: hit += 1
for e in a:
if e in x: blow += 1
blow -= hit
print '%d hit, %d blow' % (hit, blow)
while x != a:
hit, blow = 0, 0
x = raw_input('Input {0} digit number: '.format(N))
for i, e in enumerate(a):
if x[i] == e:
hit += 1
elif e in x:
blow += 1
print '{0} hit, {1} blow'.format(hit, blow)

#初心者用

# coding:utf-8

import random

print "数当てゲーム Hit & Blow"
a = []
b = []
r = random.randint(1, 9)
n = int(raw_input("遊びたい桁を入力してください(1桁以上):  "))
s = 0

while len(a) != n:
if r not in a:
a.append(r)
r = random.randint(1, 9)
while s != n:
while len(b) != n:
x = int(raw_input("予想する数字を大きい桁から１つずつエンターを押して入力してください:  "))
if x not in b:
b.append(x)
print b
else:
print "同じ数は入力できません"

c = set(a)
d = set(b)
c &= d
s = 0

for i in range(n):
if a[i] == b[i]:
s += 1
print str(len(c) - s) + "Blow"
print str(s) + "Hit"
b = []
print "おめでとう！"
```