Probability Permutations Formula question

I am a little confused by something. I understand the formula for permutations, but I don’t understand why I would divide 1 by the formula in the question asked.

The question is:
A password manager software generates 16-character passwords from a list of 127 characters (the list contains numbers, letters, or other symbols). Assume the sampling from the list is done randomly and without replacement, and find the probability of cracking a password generated by this software if we’re using the password @*AmgJ(UL3Yl726x, which has 16 characters. Assign your answer to p_crack_pass .

The answer is:

def factorial(n):
    final_product = 1
    for i in range(n, 0, -1):
        final_product *= i
    return final_product
def permutation(n, k):
    numerator = factorial(n)
    denominator = factorial(n-k)
    return numerator/denominator

total_n_outcomes = permutation(127, 16)
p_crack_pass = 1/total_n_outcomes

I am sure it is how I am interpreting the question that is confusing me. When I read the question, I keep thinking it would be 16P127 or 127!/(127-16)! and not 1/16P127.

Any assistance would be greatly appreciated!

From what you copied here, it says to find the probability of cracking the password. The probability of getting that exact password by chance is 1 out of the total possibilities (permutations). Does that make sense?


Ah!!! Thank you! That makes perfect sense!