Daniel B. answered 06/04/22
PhD in Computer Science with 42 years in Computer Research
Let P(n,k) denote the set of valid passwords of length n, containing k letters.
P(n,k) are constrained by n = 5 or 6, and k = 0, 1, or 2.
Because of formatting constraints here, I will use the notation
C(n,k) means "n chose k"
That is,
C(n,k) = n!/(n!(n-k)!)
We calculate the number of passwords in the set P(n,k).
We can chose the k positions for the k letters in C(n,k) ways.
For each of those we can chose the letters for those k positions in 26k ways.
For each of those we can chose unique digits for the remaining n-k position in
10!/(10-n+k)! ways.
Consequently
P(n,k) = C(n,k)×26k×10!/(10-n+k)!
So you need to calculate the size of P(n,k) for the six combinations of n and k,
and then add up the six results.

David W.
You said, "Let P(n,k) denote the set of valid passwords of length n, containing k letters." bu, since you use C(n,k) for Combinations, it would be good to add that P(n,k) IS NOT Permutations.06/05/22