如何在Python3.9.1中消除这个bug
我需要返回“I”还是可以返回为空
def pick_up_card(self, player, amount=1):
for i in range(1, amount+1):
# if no more card in stock pile
if not self.stock:
# add back discarded cards (but not top card)
if len(self.discards) == 1:
UI.print_message("All cards distributed")
return i-1
self.stock = self.discards[:-1]
del self.discards[:-1]
# shuffle stock
random.shuffle(self.stock)
UI.print_message("Discards are shuffled back.")
# draw stock card
card = self.stock.pop()
# and add to hand
player.hand.append(card)
return i
目前没有回答
相关问题 更多 >
编程相关推荐