Answer:
The code has 7 digits:
Here you are asking:
"What is the probability that the code is consisting only of the digits {1, 2, 3, 4, 5, 6, 7}?"
Ok, first we must calculate the number of all the possible codes.
Suppose that each digit is an independent event.
Each one of those events has 10 possible outcomes {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
And we have 7 of those.
The total number of possible combinations is equal to the product of the number of outcomes for each event, then the total number of possible combinations is:
C = 10^7.
Now let's calculate the number of possible codes if we only use the digits in the restriction.
We can do exactly the same as above, but now in each case, we have 7 possible outcomes for each digit, then in this case the number of possible combinations is:
c = 7^7.
Now the probability of generating at random a code that only uses the digits {1, 2, 3, 4, 5, 6, 7} is equal to the quotient between the number of codes that only use these digits, and the total number of possible codes.
P = c/C = (7^7)/(10^7) = (7/10)^7 = 0.082