Skip to content

Instantly share code, notes, and snippets.

@kjellski
Created November 17, 2010 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjellski/702785 to your computer and use it in GitHub Desktop.
Save kjellski/702785 to your computer and use it in GitHub Desktop.
def getClues(guess, secretNum):
# Returns a string with the pico, fermi, bagels clues to the user.
if guess == secretNum:
return 'You got it!'
clue = []
for i in range(len(guess)):
if guess[i] == secretNum[i]:
clue.append('Fermi')
elif guess[i] in secretNum:
clue.append('Pico')
if len(clue) == 0:
return 'Bagels'
clue.sort()
return ' '.join(clue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment