I am not as new to Python but I struggle quite a lot with list comprehension, I cannot seem to wrap my head around it. I am learning but would not mind advice on how to solve something in my programme I am writing in an optimal fashion. I have a constant list of labels and corresponding list of abbreviations that the user sets from the command line (or reverts to hardcoded defaults from another .py file) and then remains constant throughout the run.
However, I do not know how to write the list comprehension to include a variable amount of inputs without hard coding or using a for loop. For example:
ALPHA = ['alpha', 'beta', 'zeta']
A = ['a', 'b', 'z']
A_DICT = {'1': {'label': ALPHA[0], 'abbrev': A[0]},
'2': {'label': ALPHA[1], 'abbrev': A[1]},
'3': {'label': ALPHA[2], 'abbrev': A[2]}}
How can I create A_DICT using list comprehension if this indeed the best the way to create the dict please? The number of entries in ALPHA and A can change depending on user input. I am sorry if this is low quality/duplicate, I am trying to get my head around list comprehension but it does not quite sink in whereas other aspects of Python do with little issue.