I have a list of tuplesI want to create a new list that only has the first two fields as in:but I cannot see how to craft a list comprehension for more than one element.
I've just written a small recursive programme to generate all the possible subdivisions of a list:I've brute forced this and it's taken me a long time to figure out. I'm wondering what this is called, as I'm sure there is a name for it.
I would like to create a range (e.g. (1, 5)) of numbers with some repetitions (e.g. 4): One way would be to write: