如果您看到下面的players.py文件代码,则会将三个整数和一个列表用作first_player()的输入参数。我希望函数返回一个列表和一个整数(我只需要一个返回)。但是我只得到一个空列表。在这种情况下,如何调用列表和整数?
def dealing():
player1 = list()
start_drawing = 0
nc = 0
cards = L_shuffle_deck.shuffle_deck()
n = len(cards) - 1 # n = 51
while start_drawing < 2:
players.first_player(player1, n, nc, cards)
start_drawing += 1
nc += 1
print player1
...
def first_player(player1, n, nc, cards):
player1 = player1 + [cards[n]]
card_order = player1
changing = conv_cards.assigning(nc, card_order)
player1[nc] = changing[nc]
cards = cards[:n]
n -= 1
return player1, n #doesn't work
#I want my output to be player1(list), n(integer)
答案 0 :(得分:0)
从粗略看一下您的代码,您似乎从函数中返回值,但您不会将这些值分配给任何变量。
在dealing
函数中尝试此操作:
...
player1, n = players.first_player(player1, n, nc, cards)
...