## Selecting elements of sublists or reshaping a list of lists

I have this list

``{{{0.05792, 0.31744}, 0., 0., 0., 0.,    0.}, {0., {0.28832, 0.49024}, {0.17173, 0.386393}, 0., 0.,    0.}, {0., {0.17173, 0.386393}, {0.104, 0.352}, 0., 0., 0.}, {0., 0.,    0., {0.30752, 0.38464}, {0.322232, 0.260264}, {0.214663,     0.107331}}, {0., 0.,    0., {0.322232, 0.260264}, {0.392, 0.496}, {0.277128,     0.415692}}, {0., 0.,    0., {0.214663, 0.107331}, {0.277128, 0.415692}, {0.2, 0.4}}} ``

or in the matrix form:

I would like to convert this list to a list of two matrices, each of the same size as the input matrix, i.e. 6 by 6, where the non-zero entries for the first matrix are given by the first element of the lists in the input matrix and the same for the second matrix.

If it helps I can also create a matrix where the zeros are replaced by a list of two zeros to match the dimension.

## How to remove sublists whose difference of two elements is either 1 or 11?

I want to create a list of 3-element subsets of $$\{1,2,\cdots,12\}$$ where no two elements in each subset can have difference of 1 or 11.

The following attempt fails because it returns just a list of all subsets without restriction.

``Select[Subsets[Range[12], {3}]  , (Abs[#[[1]] - #[[2]]] != 1 || Abs[#[[1]] - #[[2]]] != 11) &&    (Abs[#[[1]] - #[[3]]] != 1 || Abs[#[[1]] - #[[3]]] != 11) &&    (Abs[#[[3]] - #[[2]]] != 1 || Abs[#[[3]] - #[[2]]] != 11) &] ``

# Edit

I just got the solution as follows, but can it be simplified?

``Select[Subsets[Range[12], {3}]   , ! MemberQ[{1, 11}, Abs[#[[1]] - #[[2]]]] &&     ! MemberQ[{1, 11}, Abs[#[[1]] - #[[3]]]] &&     ! MemberQ[{1, 11}, Abs[#[[3]] - #[[2]]]] &] // Length ``

## Sums of all sublists

The parts_sums function in the code takes a list as parameter and then returns sum of all sub-lists present in the list. e.g. if, ls = [1, 4, 6, 4] then ls contains,
ls = [1, 4, 6, 4]
ls = [4, 6, 4]
ls = [6, 4]
ls = [4]
so the function should return a new list,
nsl = [15, 14, 10, 4]

``def parts_sums(ls):     nls, c = [], 0     leng = len(ls)     for n in ls:         i, sum = 0, 0         while not i == c + 1:             i += 1             sum += ls[leng - i]         c += 1         nls.insert(0, sum)     return nls ``

## Separate sublists in more sublists

I want to separate every sublist of a list (alumnos) in other two lists (rojo and azul), considering if the name is in the next sublist and then I want to to have another two lists with the respective values. I am relativiely new with python and my best try is below, but it’s not functioning. If somebody can give me a hand, I’ll appreciate so much.

``alumnos = [['Charlie', 'Fran', 'Lucas', 'Mario', 'Juan'], ['Mario', 'Juan'],  ['Mario']] values = [[3, 2.5, 2.8, 1, 1.2], [2, 2.5], [2.8]] azul = [] rojo = [] cont = 0 while cont<3:     for l in alumnos[cont]:         if l in alumnos[cont+1]:             rojo.append(l)         else:             azul.append(l)     cont += 1 print(f'{alumnos}') print(rojo) print(azul) ``

## How to create numered sub-lists in Mail application?

Is it possible to create nested numbered lists in MacOS’s Mail client? —e.g.:

``1. Foo     1.1. Foo is cool     1.2. Foo is great 2. Bar     2.1. Bar is not so cool     2.2. Bar is not so great ``

I’ve been trying but all attempts so far have failed. This is very basic stuff. There must be a way.

I’m using MacOS Sierra (10.12.6) and Mail version 10.3 (3273).

## Google Docs Preventing Sub-Lists from restarting numbering each time

Google doc’s numbered list functionality restarts sub-list “numbering” or “sequential lettering” like this:

``1) First thing    a)    b) 2) Second thing    a) <- Sub-list numbering / sequential letters restarts    b) ``

I want it to not to restart, and to rather act like this:

``1) First thing    a)    b) 2) Second thing    c) <- Sub-list does not restart    d) ``

Is this possible?