Security and Cryptography in Python - Implementing a counter on how many permutations there are
from itertools import permutations

my_list = [1, 2, 3]

list_of_permutations = permutations(my_list)
for permutation in list_of_permutations:
    print(permutation)

Running Result:

Security and Cryptography in Python - Implementing a counter on how many permutations there are_Python

from itertools import permutations

my_list = [1, 2, 3, 4, 5, 6, 7]

list_of_permutations = permutations(my_list)
cnt = 0
for permutation in list_of_permutations:
    cnt += 1
print(len(my_list), cnt)

Running Result:

Security and Cryptography in Python - Implementing a counter on how many permutations there are_Privacy_02

相信未来 - 该面对的绝不逃避,该执著的永不怨悔,该舍弃的不再留念,该珍惜的好好把握。