它出于某种原因重复了第一个问题

It repeats the first question for some reason

tic_row1=[7,8,9]
tic_row2=[4,5,6]
tic_row3=[1,2,3]

# Display the grid
def grid_display():
    print(tic_row1)
    print(tic_row2)
    print(tic_row3)

def choice_check():
    
   
    #Choose a plot
    plot='pick'
    number_range= range(0,10)
    number_check=False

    while plot.isdigit()==False or number_check==False:
        plot=input('Please pick a plot number (1-9): ')

        if plot.isdigit()==False:
            plot=input("That isn't a number!")
        if plot.isdigit()==True:
            if int(plot) in number_range:
                number_check=True
            else:
                print("The number must be from (1-9)!")
                number_check=False
    return int(plot)



def game_initiate():
    plot=choice_check()
    team='cookie'
    index=None
    while team != 'x' or 'o':
        team=input("Choose 'X' or 'O': ")

        if team.islower() == 'x' or 'o':
            if plot in range(7,10):
                index=tic_row1.index(plot)
                tic_row1[index]=team
                return tic_row1
            elif plot in range(4,7):
                index=tic_row2.index(plot)
                tic_row2[index]=team
                return tic_row2
            if plot in range(1,4):
                index=tic_row3.index(plot)
                tic_row3[index]=team
                return tic_row3

def game_order():
    nums=range(1,10)
    while nums in tic_row1 or tic_row2 or tic_row3:
        grid_display()
        choice_check()
        game_initiate()

game_order()

所以我制作了这款井字游戏,最终它成功了。出于某种原因,它询问了句子 'Please pick a plot number (1-9):' 两次。问题出在 'choice_check' 函数中,即打印网格下的第二个函数。 也许我只是瞎了眼,但我想不出为什么要这样做。在我的初学者看来,一切都很好。

对于那些想要复制固定版本的人。再次感谢那些强调我多次阅读和错过的内容的人。

tic_row1=[7,8,9]
tic_row2=[4,5,6]
tic_row3=[1,2,3]

# Display the grid
def grid_display():
    print(tic_row1)
    print(tic_row2)
    print(tic_row3)

def choice_check():
    
   
    #Choose a plot
    plot='pick'
    number_range= range(0,10)
    number_check=False

    while plot.isdigit()==False or number_check==False:
        plot=input('Please pick a plot number (1-9): ')

        if plot.isdigit()==False:
            plot=input("That isn't a number!")
        if plot.isdigit()==True:
            if int(plot) in number_range:
                number_check=True
            else:
                print("The number must be from (1-9)!")
                number_check=False
    return int(plot)



def game_initiate():
    plot=choice_check()
    team='cookie'
    index=None
    while team != 'x' or team != 'o':
        team=input("Choose 'X' or 'O': ")

        if team.islower() in {'x','o'}:
            if plot in range(7,10):
                index=tic_row1.index(plot)
                tic_row1[index]=team
                return tic_row1
            elif plot in range(4,7):
                index=tic_row2.index(plot)
                tic_row2[index]=team
                return tic_row2
            if plot in range(1,4):
                index=tic_row3.index(plot)
                tic_row3[index]=team
                return tic_row3

def game_order():
    nums=range(1,10)
    while nums in tic_row1 or tic_row2 or tic_row3:
        grid_display()
        game_initiate()

game_order()

game_order()方法中删除"choice_check()",如下:

def game_order():
    nums=range(1,10)
    while nums in tic_row1 or tic_row2 or tic_row3:
        grid_display()
        game_initiate()