I have a dictionary structured as {a_1: [((b_11,c_11),d_11), ((b_12, c_12), d_12), ...], a_2: [...], ...}
.
I want to extract the maximum abs(c) among all the possible c values. Currently I'm doing this throught two for loops. One for each a, and other for each of set {b,c,d}.
elements = {
0: [((0, -4), 1)],
1: [((1, -5), 1), ((0, -4), 1)],
2: [((2, -3), 1)],
3: [((3, -2), 1), ((0, -5), 1)],
}
max_c = 0
for a in list(elements):
for (b, c), d in elements[a]:
max_c = max(max_c, abs(c))
Is there any way to do this without the for loops? and if it is, is it pythonic? or I should keep this way because it's more understandable?
Thanks in advance.