0

I have two lists, one for attributes the other for statistics:

l1 = ['speed', 'accel']
l2 = ['min', 'max', 'mean', 'std']

I want to generate this expanded list of attributes' statistics:

l3 = ['speed_min', 'speed_max', 'speed_mean', 'speed_std', 'accel_min', 'accel_max', 'accel_mean', 'accel_std']

In that order.

Amina Umar
  • 502
  • 1
  • 9

1 Answers1

0

According to your desired output it will be like this:

resultList = list()
l1 = ['speed', 'accel']
l2 = ['min', 'max', 'mean', 'std']

for i in l1:
    for j in l2:
        resultList.append(i+'_'+j)
print(resultList)
Manvi
  • 171
  • 11