1

I have created a list as following:

possible_team = [(t, h, dps1, dps2, dps3) 
                for t in all_T 
                for h in all_H
                for dps1 in all_DPS
                for dps2 in all_DPS
                for dps3 in all_DPS]

But if there are more elements in the list, such as 2t, 6h and 17dps, how can I avoid to write all the element names? such as:

possible_team = [(t1, t2, h1, h2, ... h5, dps1, dps2, dps3 ... dps17) 
                for t1 in all_T
                for t2 in all_T
                ...
                for dps1 in all_DPS
                for dps2 in all_DPS
                ...
                for dps17 in all_DPS]

I have tried to write the keys as (t)*2, (h)*5 and (dps)*17:

possible_team = [([t] * 2, [h] * 5, [dps] * 17) 
            for t in all_T 
            for h in all_H
            for dps in all_DPS]

but they are returned with duplicate values, and each in a list.

Is there any simple method to get a list as [t1, t2, h1, h2, ... h5, dps1, dps2, ... dps17], with each element in a single loop?

Maelstrom
  • 43
  • 7

1 Answers1

1

What about

possible_team = all_T + all_H + all_DPS

? (Not sure if I understood your question right.)

jammon
  • 3,404
  • 3
  • 20
  • 29