MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / getSecretNum

Function getSecretNum

src/gamesbyexample/bagels.py:59–68  ·  view source on GitHub ↗

Returns a string made up of NUM_DIGITS unique random digits.

()

Source from the content-addressed store, hash-verified

57
58
59def 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
71def getClues(guess, secretNum):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected