如何在python中使用检查功能?

我目前正在完成一个go fish程序和python,并且正在努力确定如何“检查”一只手中是否有4张相同等级的牌(ace,2等)并将其删除。我当前的代码如下,

def check(hand, score):

   for i in range(len(hand)- 1):

    j = hand[i]

    if j == 4:

      print("you have completed a set :)")

      for j in range(4):

        hand.remove[j]

    score += 1

  else:

    print("no sets have been found ☹")

有什么建议么?

评论