I am trying to apply the accepted solution to this question to the problem below but stupidly I cannot:
In:
increment='increment'
[f'{level_A}_{level_B}_{level_C}_{increment}'
for level_A, rng in [(5, list(range(1,3))), (6, list(range(1,3)))]
for level_B in rng
for level_C in range(1, 5)]
Out:
['5_1_1_increment',
'5_1_2_increment',
'5_1_3_increment',
'5_1_4_increment',
'5_2_1_increment',
'5_2_2_increment',
'5_2_3_increment',
'5_2_4_increment',
'6_1_1_increment',
'6_1_2_increment',
'6_1_3_increment',
'6_1_4_increment',
'6_2_1_increment',
'6_2_2_increment',
'6_2_3_increment',
'6_2_4_increment']
Where the increment values need to be 1,2,3,..15,16. Importantly, I need to do this in a single line (ie no variable definition outside the comprehension) and ideally without any imports (like in the original question's accepted answer)