[숫자야구게임]
# 숫자야구게임
import random
randomnum = []
a = random.randint(1, 9)
b = random.randint(1, 9)
while a==b:
b = random.randint(1, 9)
c = random.randint(1, 9)
while a==c or b==c:
c = random.randint(1, 9)
randomnum.append(a)
randomnum.append(b)
randomnum.append(c)
result = True
while result:
st = 0
ball = 0
lnputlist = []
a,b,c = map(int,input('숫자 세 개를 입력하세요: ').split())
lnputlist.append(a)
lnputlist.append(b)
lnputlist.append(c)
for i in range(0,len(lnputlist)) :
if lnputlist[i] in randomnum:
ball+=1
if lnputlist[i] == randomnum[i]:
st+=1
if ball > 0:
ball-=1
else :
ball = 0
print("스트라이크:",st, "볼:",ball)
if st == 3:
result=False