Returns a string made up of NUM_DIGITS unique random digits.
()
| 57 | |
| 58 | |
| 59 | def getSecretNum(): |
| 60 | """Returns a string made up of NUM_DIGITS unique random digits.""" |
| 61 | numbers = list('0123456789') # Create a list of digits 0 to 9. |
| 62 | random.shuffle(numbers) # Shuffle them into random order. |
| 63 | |
| 64 | # Get the first NUM_DIGITS digits in the list for the secret number: |
| 65 | secretNum = '' |
| 66 | for i in range(NUM_DIGITS): |
| 67 | secretNum += str(numbers[i]) |
| 68 | return secretNum |
| 69 | |
| 70 | |
| 71 | def getClues(guess, secretNum): |