Casepy package
casepy (instant methods)
- instant_method.all_permutations(in_number_of_select: int) list
Return all permutations of the list.
- Parameters:
- Returns:
All permutations of the list.
- Return type:
Examples
>>> result = all_permutation([1, 2, 3, 3], 2) >>> print(result) [[1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2], [3, 3]]
- instant_method.n_th_permutation(in_list: list, in_number_of_select: int) list
Return the n-th permutation of the list.
- Parameters:
- Returns:
The n-th permutation of the list.
- Return type:
Examples
>>> result = n_th_permutation(3, [1, 2, 3, 3], 2) >>> print(result) [2, 3]
- instant_method.n_to_m_th_permutations(in_m_iterator: int, in_list: list, in_number_of_select: int) list
Return list of permutations from n-th to m-th.
- Parameters:
- Returns:
List of permutation from n-th to m-th.
- Return type:
Examples
>>> result = n_to_m_th_permutation(2, 4, [1, 2, 3, 3], 2) >>> print(result) [[2,1],[2,3],[3,1]]
- instant_method.all_combinations(in_number_of_select: int) list
Return all combinations of the list.
- Parameters:
- Returns:
All combinations of the list.
- Return type:
Examples
>>> result = all_combination([1, 2, 3, 3], 2) >>> print(result) [[1, 2], [1, 3], [2, 3]]
- instant_method.n_th_combination(in_list: list, in_number_of_select: int) list
Return the n-th combination of the list.
- Parameters:
- Returns:
The n-th combination of the list.
- Return type:
Examples
>>> result = n_th_combination(2, [1, 2, 3, 3], 2) >>> print(result) [2, 3]
- instant_method.n_to_m_th_combinations(in_m_iterator: int, in_list: list, in_number_of_select: int) list
Return list of combinations from n-th to m-th.
- Parameters:
- Returns:
List of combination from n-th to m-th.
- Return type:
Examples
>>> result = n_to_m_th_combinations(2, 4, [1, 2, 3, 3], 2) >>> print(result) [[2, 3], [3, 1], [3, 2]]
casepy.permutation_generator
- class casepy.PermutationGenerator
Bases:
objectPermutationGenerator is designed to generates all possible permutations of elements in a list with a given number of selections. The permuation is generated by a given iterator number and it is the n-th permutation of the all possible permutations. As default, the n-th permutation is generated by the lexicographic order. But, if the priority of the elements is given, the permutation is generated by the given priority.
The elements can be duplicated in the list.
- all_cases() list
Return all possible permutations from a set parameters.
- Returns:
All possible permutations.
- Return type:
casepy.combination_generator
- class casepy.CombinationGenerator
Bases:
objectCombinationGenerator is designed to generates all possible combinations of elements in a list with a given number of selections. The combination is generated by a given iterator number and it is the n-th combination of the all possible combinations. As default, the n-th combination is generated by the lexicographic order. But, if the priority of the elements is given, the combination is generated by the given priority.
The elements can be duplicated in the list.
- all_cases()
Return all possible combinations of the list.
- Returns:
All possible combinations of the list.
- Return type: