bearophile wrote:
Think about a "Bulls and cows" game (it's a task of Rosettacode site), it's
similar to MasterMind, at the beginning you need to generate the secret key,
four random distinct digits, that later are used in the program, the user has
to guess them using the number of right items in the right place, or right
items in the wrong place. To generate the key in Python you may use
"".join(sample(d, 4)).

Generate a 4 digit random integer and convert it to a string. It's probably a lot more efficient than the Python version.

Reply via email to