lundi 24 décembre 2018

Can't assign to operator .Multiple assignments in if statement in python

The 4th elif ending is throwing an error can't assign to operator.I am trying to design a tic tac toe game and assigning players X and 0 based upon their selection.can't assign to operator

def player_input(player):
    marker = ''
    while(marker != 'X' and marker != '0'):
        marker = input('{},choose X or 0:'.format(player))

    if(player == 'Player1' and marker == 'X'):
        temp_player1 = 'Player1' and player1_marker = 'X' and temp_player2 = 'Player2' and player2_marker = '0'
    elif(player == 'Player1' and marker == '0'):
        temp_player1 = 'Player1' and player1_marker = '0' and temp_player2 = 'Player2' and player2_marker = 'X'
    elif(player == 'Player2' and marker == 'X'):
        temp_player1 = 'Player1' and player1_marker = '0' and temp_player2 = 'Player2' and player2_marker = 'X'
    elif(player == 'Player2' and marker == '0'):
        temp_player1 = 'Player1' and player1_marker = 'X' and temp_player2 = 'Player2' and player2_marker = '0'
    else:
        pass

    return(temp_player1,player1_marker,temp_player2,player2_marker)

Aucun commentaire:

Enregistrer un commentaire