Lets suppose that the numbers that the spy saw were 1,2,3,4,5,6 and by the question we know that the password has 7 digits, meaning that one of those number repets itself. We dont know wich one repets, so we need to keep that in mind. First, lets imagine that the number 1 repeats, so one of the possibilities is:
We can see that to find all the possibilities of passwords with 1 repeating is a permutation with repetition. So the amount of passwords that we can have is:
Now, we just need to calculate the possibilities when 2,3,4,5 or 6 repeats:
So, in total we have 15120 possibilities of passwords, so the probability of a spy getting the password first try is: