How can I iron out this bug in python 3.9.1.
Do I need to return 'i' or can return be blank?
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