Python 3编程连续4 [暂停]

loading...


-4
def populate(initial_game):
    num_of_rows = 5
    num_of_cols = 5
    initial_game = [[0 for row in range (num_of_rows)] for col in range (num_of_cols)]
    initial_game = "\n".join(" ".join(map(str, line)) for line in initial_game)
    print(initial_game)
    return initial_game

def player1(initial_game):
    print()
    x = input("Player 1: Input square to play? ")
    return initial_game

def player2(initial_game):
    print()
    y = input("Player 2: Input square to play? ")
    return initial_game

我如何允许用户在矩阵中输入1或2,具体取决于它是播放器1还是播放器2?

例如Player-1:输入正方形:25

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 1

我怎样才能做到这一点?

loading...

0回答

No Data

评论

暂时没有评论!