I have a tuple (1,2,5,3,2,1,3,4,1) and want to find the amount of combinations of 1 and 2. So in this example it should return 2 because there are 3 times a 1 but only 2 times a 2.
The task that I want to solve is:
Give the amount of possible combinations by
1and2. Each number can only be used once for a combination.
I already solved the issue with this code:
count1 = tuple.count(number1)
count2 = tuple.count(number2)
if count1 < count2:
return count1
else:
return count2
return count1
But because I want to learn more magic things with numpy, I would like to know if there is a better solution to use it here.