我从这段代码中得到一个错误。在
fighter1, fighter2 = random.sample(players, 2)
f1index = (players).index(fighter1)
f2index = (players).index(fighter2)
# ^ finds both fighters index in list
f1strength = strengths.f1index
f2strength = strengths.f2index
# ^ finds fighters strength attributes
这是我得到的错误。在
^{pr2}$
要访问位于
f1index
的元素,必须使用下标表示法,如下所示相关问题 更多 >
编程相关推荐