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
def valida_q_magico(q_magico): | |
if len(q_magico) == 0 or len(q_magico) != len(q_magico[0]): | |
return False | |
linhas_ok = not sum( | |
1 if sum(linha) != sum(q_magico[0]) else 0 | |
for linha in q_magico | |
) | |
colunas_ok = not sum( | |
sum( | |
linha[i] for linha in q_magico |
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
# python 2.7 | |
import urllib | |
import json | |
resp = urllib.urlopen('http://worldcup.sfg.io/matches').read() | |
for jogo in json.loads(resp.decode('utf-8')): | |
if jogo['status'] == 'completed': | |
print "%s %i x %s %i" % (jogo['home_team']['country'], jogo['home_team']['goals'], jogo['away_team']['country'], jogo['away_team']['goals']) |
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
#!/usr/bin/env python | |
import os | |
import re | |
import subprocess | |
import sys | |
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)') | |
CHECKS = [ |