在anaconda上,运行代码时没有出现任何错误,但是在IDLE中出现了以下错误
player1_marker, player2_marker = player_input()
TypeError: 'NoneType' object is not iterable
我的代码是
# THE FUNCTION
def player_input():
marker = ''
while not (marker == 'X' or marker == 'O'):
marker = input('Player 1: Do you want to be X or O? ').upper()
if marker == 'X':
return ('X', 'O')
else:
return ('O', 'X')
while True:
theBoard = [' '] * 10
player1_marker, player2_marker = player_input()
turn = choose_first()
print(turn + ' will go first.')
play_game = input('Are you ready to play? Enter Yes or No.')
if play_game.lower()[0] == 'y':
game_on = True
else:
game_on = False