Python-based permutation and combination computing operation example, python example
This article describes how to arrange and combine computing operations implemented by Python. We will share this with you for your reference. The details are as follows:
1. Call scipy to calculate the specific value of the permutation and combination.
> From scipy. special import comb, perm> perm (3, 2) 6.0> comb (3, 2) 3.0
2. Call itertools to obtain the total number of permutation and combination Conditions
> From itertools import combinations, permutations> permutations ([1, 2, 3], 2) <itertools. permutations at 0x7febfd880fc0> # iteratable Object> list (permutations ([1, 2, 3], 2) [(1, 2), (1, 3 ), (2, 1), (2, 3), (3, 1), (3, 2)]> list (combinations ([1, 2, 3], 2) [(1, 2), (1, 3), (2, 3)]
PS: Here are some recommended computing tools for your reference:
Calculation tool for online mona1 functions (equations:
Http://tools.jb51.net/jisuanqi/equ_jisuanqi
Scientific calculator online use _ advanced calculator online computing:
Http://tools.jb51.net/jisuanqi/jsqkexue
Online calculator _ standard calculator:
Http://tools.jb51.net/jisuanqi/jsq