函数之间未设置变量

时间:2019-04-23 21:07:18

标签: python

我正在尝试读取代码,以检查变量是否为1,然后打印一些内容,但未设置该变量。

row_picked = 0
row = 0
column_picked = 0
column = 0
board = [[" ", "d ", " "], [" ", " ", " "], [" ", " ", " "]]


def turn(row_picked,row):
    row_picked = 0
    while row_picked == 0:
        row = 0
        row = int(input("What do you want? "))
        if row is 1:
            row_picked = 1
        elif row is "2":
            row_picked = 1
        elif row is "3":
            row_picked = 1
        else:
            print("Invaild Row try again")
        return print(row)

def placement(board):
    turn(row_picked, row)
    turn(column_picked, column)
    print(row)
    if row == 1 :
        print(board)
    return board



placement(board)

我的目标是打印电路板,但是,行设置为0

0 个答案:

没有答案