“ NoneType”对象不可迭代4

时间:2018-11-16 01:06:56

标签: python python-3.x

在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

0 个答案:

没有答案