😂내 코드
def solution(lottos, win_nums):
answer = []
win=win_nums
c=0
c2=0
#최고
for i in range(6):
if lottos[i] in win_nums:
c+=1
if lottos[i]==0:
c+=1
#최저
for i in range(6):
if lottos[i] in win_nums:
c2+=1
a= rank(c)
b= rank(c2)
answer=[a,b]
return answer
def rank(c):
if c==6: return 1
elif c==5: return 2
elif c==4:return 3
elif c==3: return 4
elif c==2: return 5
else: return 6
💥💥매우 심플한 코드
def solution(lottos, win_nums):
rank=[6,6,5,4,3,2,1]
cnt_0 = lottos.count(0)
ans = 0
for x in win_nums:
if x in lottos:
ans += 1
return rank[cnt_0 + ans],rank[ans]