Skip to content

Instantly share code, notes, and snippets.

View vr2262's full-sized avatar
๐Ÿ‘€
ok

Viktor Roytman vr2262

๐Ÿ‘€
ok
View GitHub Profile
@vr2262
vr2262 / flipper.py
Last active December 12, 2015 09:08
import sys
import argparse
import itertools as it
import numpy as np
def flipper(n):
def cool_range_doritos(*args, **kwargs):
if sys.version_info[0] < 3:
return xrange(*args, **kwargs)
import math
# Get the value of n and initialize the matrices A and B.
with open("input.txt", "r") as matrix_info:
n = int(matrix_info.readline())
assert n == 2 ** math.log(n, 2), "The first line must be a power of 2."
mat_a = []
mat_b = []
import numpy as np
import csv
def compute_sum(infile):
"""
Returns the sum of numbers in a file with one column and a header row.
Parameters
----------
infile : File object