Skip to main content
0 votes
1 answer
144 views

I have a list d_n of n integers and the results Z_klm of a function fun(dk, dl, dm) for all binom(n, 3) combinations without repetition (k, l, m) out of d_n indices. Now, for all binom(n, 2) ...
Max Pierini's user avatar
  • 2,323
3 votes
4 answers
206 views

I need to get the Cartesian product of a dictionary {str: Fraction} with itself, but currently need to "loop" through the dict twice, once for the keys and once for the values. The ...
Ameya's user avatar
  • 1,770
5 votes
2 answers
160 views

It seems that even when islice would theoretically be better, in practice, it is slower than just using slice. So I am a bit puzzled by the difference in performance between the usage of slice and ...
Mathias Sven's user avatar
2 votes
1 answer
179 views

Input: a list of m prime numbers (with possible repetition), and integers n and t. Output: all sets of n numbers, where each set is formed by partitioning the input into n parts, and taking the ...
theozh's user avatar
  • 27k
1 vote
0 answers
67 views

I'm using python itertools specifically to generate combinations of integer strings. I have already created the loop that will loop through the combinations one at a time. I just need someone to help ...
user27394478's user avatar
1 vote
2 answers
60 views

I'm using the below to skip a group of records when a certain condition is met: if (condition met): ... [next(it) for x in range(19)] Where it is an itertuples object created to speed up ...
Chris's user avatar
  • 1,700
1 vote
1 answer
96 views

I am adding type hints to an old code of mine. However, I find with a "problem" I don't know how to solve. I have a function that looks like: def f(x: tuple[tuple[int, int], ...]): ... ...
Gaussian97's user avatar
1 vote
1 answer
111 views

Assume that I want to assign a color to 5 different balls and have 3 colors r,b and g. I would like to iterate over all these combinations. Preferably I would want to omit combinations that are equal ...
Trailblazer's user avatar

15 30 50 per page
1
2 3 4 5
210