Last active
August 29, 2015 14:18
-
-
Save joffilyfe/f343145e259e4a42cd5b to your computer and use it in GitHub Desktop.
Teste de seleção para programador PHP na Folha (http://hotsites.folha.com.br/2015/03/31/selecao/) - Feito em python e facilmente portado para qualquer linguagem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
code = { | |
'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': 7, 'H': 8, | |
'I': 9, 'J': 10, 'K': 11, 'L': 12, 'M': 13, 'N': 14, 'O': 15, 'P': 16, | |
'Q': 17, 'R': 18, 'S': 19, 'T': 20, 'U': 21, 'V': 22, 'W': 23, | |
'X': 24, 'Y': 25, 'Z': 26 | |
} | |
names = [ | |
['HALLEY', 'AMARELO'], | |
['ENCKE', 'VERMELHO'], | |
['WOLF', 'PRETO'], | |
['KUSHIDA', 'AZUL'] | |
] | |
for line in names: | |
result = [] | |
for i, name in enumerate(line): | |
math = 1 | |
for n in name: | |
math = code[n] * math | |
result.append(math%45) | |
if (i == 1): | |
if result[0] != result[1]: | |
print('O grupo {} não será recrutado.'.format(line[i)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment