Last active
December 4, 2018 11:55
-
-
Save fcschmidt/dfe5b307b722de6d72a84ff42b73fcd5 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
def calcula_idade(d): | |
for r in range(0, len(d)): | |
ano = d[r]['data'][2] | |
idade = 2018 - ano | |
d[r]['data'] = idade | |
d[r]['categoria'] = '' | |
if idade <= 16: | |
d[r]['categoria'] = 'infanto' | |
elif 17 <= idade <= 18: | |
d[r]['categoria'] = 'juvenil' | |
elif 19 <= idade <= 20: | |
d[r]['categoria'] = 'junior' | |
else: | |
d[r]['categoria'] = 'profissional' | |
return d | |
def main(): | |
qnt_jogadores = int(input()) | |
jogadores = [] | |
for r in range(0, qnt_jogadores): | |
nome = input() | |
data = list(map(int, input().split())) | |
jogador = { | |
'nome': nome, | |
'data': data | |
} | |
jogadores.append(jogador) | |
res = calcula_idade(jogadores) | |
for r in range(0, len(res)): | |
print( | |
'%s %s %s' % (res[r]['nome'], res[r]['data'], res[r]['categoria']) | |
) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment