Permutation and combination using python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Permutation and combination using python

How can we count the no. Of permutations possible ?

28th Jun 2019, 4:48 PM
Muskaan
Muskaan - avatar
3 Answers
+ 8
from itertools import permutations print(len(list(permutations('abcde'))))
28th Jun 2019, 5:58 PM
Anna
Anna - avatar
+ 4
The length of permutation of a number is equal to the factorial of the number of elements. For example "abc" has 3 elements, the factorial number of 3 is 6 (3*2*1) so it has 6 possible permutations: ("abc","acb","bac","bca","cba","cab")
28th Jun 2019, 5:01 PM
Mo Hani
Mo Hani - avatar
0
The fectorial number 3 is 6 (3*2*1)so it has 6 possible permutations: ("NDC","NCD","DCN","DNC", "CND","CDN")
18th Sep 2019, 4:21 PM
Shailesh Changani