Python 坏量程/透镜使用

Python 坏量程/透镜使用,python,range,Python,Range,假设函数中被调用的函数工作正常(它是)。我做错了什么 def board_contains_word_in_column(board, word): """ (list of list of str, str) -> bool Return True if and only if one or more of the columns of the board contains word. Precondition: board has at least

假设函数中被调用的函数工作正常(它是)。我做错了什么

def board_contains_word_in_column(board, word):
    """ (list of list of str, str) -> bool

    Return True if and only if one or more of the columns of the board
    contains word.


    Precondition: board has at least one row and one column, and word is a
    valid word.

    >>> board_contains_word_in_column([['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']], 'NO')
    False
    """


    for char in range(len(board)):
        if word in make_str_from_column(board,char):
            return True

    return False
len(板)
为2。我猜你的意思是
len(board[0])
它是4

下面是编写函数的简单方法提示

>>> board = [['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']]
>>> tuple('NO') in zip(*board)
False
>>> tuple('NS') in zip(*board)
True
len(板)
为2。我猜你的意思是
len(board[0])
它是4

下面是编写函数的简单方法提示

>>> board = [['A', 'N', 'T', 'T'], ['X', 'S', 'O', 'B']]
>>> tuple('NO') in zip(*board)
False
>>> tuple('NS') in zip(*board)
True

请修复缩进。对不起,我对python相当陌生。这里出了什么问题?您的代码应该从缩进级别
def
Ah缩进,因为它处于空闲状态-复制粘贴混乱。感谢您指出这一点,以备将来参考。但请修复粘贴的代码(问题下方有一个编辑按钮)。请修复缩进。对不起,我对python还比较陌生。这里出了什么问题?您的代码应该从缩进级别
def
Ah缩进,因为它处于空闲状态-复制粘贴混乱。感谢您指出这一点,以备将来参考。但请修复粘贴的代码(问题下方有一个编辑按钮)。