我有問題,該代碼數在python參數
import random
class MyPlayer:
def __init__(self, payoff_matrix, number_of_iterations=0):
self.payoff_matrix = payoff_matrix
self.number_of_iterations = number_of_iterations
self.opponent_move = None
self.opponent_move_history = list()
def move(self): #move is random, True or False
return random.choice(False, True)
def record_opponents_move(self, opponent_move): #recording opponents moves
self.opponent_move = opponent_move
self.opponent_move_history.append(opponent_move)
Pycharm依然呈現出類型錯誤:選擇()到底需要2個參數(3給定的),我不明白真和假都只是2參數呢?或不?
可能值得指出OP示例中的「第三」參數是「隨機」本身 – brianpck