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
resultado = [] | |
soma = 0 | |
a = 2 | |
for i in range(10): | |
soma += a | |
result[i] = soma | |
print str(result) |
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
import sys | |
convert = {1:0, 2:1, 3:1, 4:0, 5:1, 6:0, 7:1, 8:0, 9:0, 0:0} | |
a = [1,2,3,4,5,6,7,8,9,0] | |
print "Original array", str(a) | |
print "Converted array", | |
itera = (convert[key] for key in a) | |
for v in itera: | |
sys.stdout.write('%d' % v) |
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
''' | |
Created on 15/10/2014 | |
@author: mvalle | |
''' | |
import unittest | |
from decimal import Decimal | |
OPS = { |
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
''' | |
Created on 15/10/2014 | |
@author: mvalle | |
''' | |
import unittest | |
from decimal import Decimal | |
OPS = { |
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
''' | |
Created on 18/10/2014 | |
@author: mvalle | |
''' | |
from urllib2 import urlopen | |
import json | |
if __name__ == '__main__': | |
f = urlopen("https://gist.githubusercontent.com/anonymous/acbd70c0616e4225764c/raw/41e9b49faf122d346cce0b5bc12176e33874034a/gistfile1.txt") |
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 | |
''' | |
Created on 21/10/2014 | |
@author: mvalle | |
''' | |
import csv |
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
/* | |
def insert_char(char: Char, list: List[(Char, Int)]): List[(Char, Int)] = { | |
if (list.isEmpty) | |
return List((char, 1)) | |
if (char == list.head._1) | |
return (char, list.head._2 + 1) :: list.tail | |
list.head :: insert_char(char, list.tail) | |
} | |
*/ | |
def insert_char(char: Char, list: List[(Char, Int)]): List[(Char, Int)] = list match { |
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
class Classe1 { | |
Classe1(int a); | |
}; | |
class Classe2 { | |
Classe1 c1; | |
void do_something(Classe1 &arg) { | |
c1 = arg; | |
// do other something | |
} |
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
RunArgs = namedtuple("RunArgs", ["day", "low", "high", "idx", "num"]) | |
def build_run_args_map(): | |
args_per_day = """ | |
F 11265069 11420695 41 500000 | |
F 11420695 11563706 42 500000 | |
F 11563706 11644847 43 500000 | |
F 11644847 11723533 44 500000 | |
F 11723533 11797201 45 500000 | |
F 11797201 11868330 46 500000 | |
F 11868330 12000000 47 500000 |
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
def only_in_x_generator(x, y): | |
ix = 0 | |
iy = 0 | |
while ix < len(x) and iy < len(y): | |
if x[ix] < y[iy]: | |
yield x[ix] | |
ix += 1 | |
elif x[ix] > y[iy]: | |
iy += 1 | |
else: |
OlderNewer