Skip to content

Instantly share code, notes, and snippets.

@arthurbarros
Last active August 29, 2015 14:18
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 arthurbarros/fe0ab1dce62ad61d63b2 to your computer and use it in GitHub Desktop.
Save arthurbarros/fe0ab1dce62ad61d63b2 to your computer and use it in GitHub Desktop.
Solução para o problema proposto em http://hotsites.folha.com.br/2015/03/31/selecao/
import string
def words_product(word):
words = string.ascii_uppercase
multiplier = 1
for letter in word.upper():
multiplier *= words.index(letter) + 1
return multiplier % 45
def employed_devs(comet, group):
return words_product(comet) == words_product(group)
for comet, group in [('HALLEY','AMARELO'), ('ENCKE','VERMELHO'), ('WOLF','PRETO'), ('KUSHIDA','AZUL')]:
if employed_devs(comet, group) == False:
print 'Sentimos muito em informar que ninguem do grupo %s e cometa %s sera levado :(' % (comet, group)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment