I create a list as follows:
['v0' if x%4==0 else 'v1' if x%4==1 else 'v2' if x%4==2 else 'v3' for x in list_1]
How to generalize the creation of such a list, so that it can be easily expanded by a larger number of variables and subsequent conditions?
Aucun commentaire:
Enregistrer un commentaire