dimanche 23 octobre 2016

Number of arguments in python

I have problem with this code

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 is still showing a TypeError: choice() takes exactly 2 arguments (3 given), I dont get it True and False are just 2 arguments? Or not?




Aucun commentaire:

Enregistrer un commentaire