mardi 30 janvier 2018

I can't select a random variable from a list [on hold]

For some reason I can't seem to select a variable from a list. I know my syntax is right, so any help would be appreciated. Here is the error

random.choice(Board)='X'

SyntaxError: can't assign to function call

Thanks!

import random
Board1 ='|'
Board2 ='|'
Board3 ='|'
Board4 ='|'
Board5 ='|'
Board6 ='|'
Board7 ='|'
Board8 ='|'
Board9 ='|'
Board=[Board1,Board2,Board3,Board4,Board5,Board6,Board7,Board8,Board9]
turn_count = 1
def printBoard():
    print(Board1 + ' ' + Board2 + ' ' + Board3)
    print(Board4 + ' ' + Board5 + ' ' + Board6)
    print(Board7 + ' ' + Board8 + ' ' + Board9)

print('The computer will go first, you are O')
if turn_count == 1:
    random.choice(Board)='X'
    printBoard()




Aucun commentaire:

Enregistrer un commentaire