def adjacent_enemy(inp, rowI, colI, enemy):
    'Check for enemy in adjacent square'
    if any(((x[0] == enemy) for x in [inp[(rowI + 1)][colI], inp[(rowI - 1)][colI], inp[rowI][(colI + 1)], inp[rowI][(colI - 1)]])):
        return True
    return False
Check for enemy in adjacent square
def adjacent_enemy(inp, rowI, colI, enemy):
    
    if any(((x[0] == enemy) for x in [inp[(rowI + 1)][colI], inp[(rowI - 1)][colI], inp[rowI][(colI + 1)], inp[rowI][(colI - 1)]])):
        return True
    return False