Skip to content

Instantly share code, notes, and snippets.

@fcschmidt
Last active December 4, 2018 11:55
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 fcschmidt/dfe5b307b722de6d72a84ff42b73fcd5 to your computer and use it in GitHub Desktop.
Save fcschmidt/dfe5b307b722de6d72a84ff42b73fcd5 to your computer and use it in GitHub Desktop.
#!/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