[Solved] how to get all possible combinations when both a symbol and set of symbols could have different values [closed]

[ad_1] You can use itertools to do this: from itertools import permutations strings = [‘a’,’b’,’c’,’d’,’ab’,’cd’,’abc’] all_combin = [s for i in range(2,len(strings)+1) for s in permutations(strings,i)] # List of all possible combinations of letters from the list num = [] for n in all_combin: if ”.join(n) == ‘abcd’: a=”” for l in n: a += … Read more

[Solved] combinations for numbers 0 to 40 [closed]

[ad_1] In haskell: [(x, y) | x <- [1..40], y <- [1..40]] In other languages you should probably look at for-loops: (this is C#) Tuple<int, int>[,] things = new Tuple<int, int>[40,40]; for (int i = 0; i < 40; i++) { for (int j = 0; j < 40; j++) { things[i,j] = Tuple.Create(i+1,j+1); } … Read more