“function”对象不能解释为整数

2024-06-16 18:00:14 发布

您现在位置:Python中文网/ 问答频道 /正文

def findA(deck):
    position1 = deck.index((1, 0))
    position2 = deck.index((2, 0))
    if position1 < position2:
        findA = position1
        return position1
    else:
        findA = position2
        return position2 
    return(findA)

def split(deck):
    beforeA = []
    betweenAB = []
    afterB = []
    length = len(deck)

for i in range(0, findA):
    insert_card(pick_card(deck), beforeA)
for i in range(findB, lenght):
    insert_card(pick_card(deck), afterB)
print("A: ", (beforeA))
print("B: ", (afterB))

所以当我启动这个程序时,我收到一条错误消息,说函数不能是我的“for i in range(0,findA):”中的int,我知道了,但是我不知道该怎么做,而不是尝试使用def findA。有没有什么我可以用我的芬达在范围内?还是我能做得更好?在

抱歉,如果这是简单的和糟糕的解释,但我是新的编程


Tags: inforindexreturndefrangecardinsert