from math import factorial mot = input("Entrez un mot : ") n = len(mot) dico = dict() for lettre in mot: if lettre not in dico: dico[lettre] = 1 else: nb = dico.get(lettre) dico[lettre] = nb + 1 P = 1 for cle, valeur in dico.items(): P = P * factorial(valeur) N = int(factorial(n) / P) print("Le nombre d'anagrammes de",mot," est égal à",N, end=".")