Ethiopian multiplication: Difference between revisions

m
Line 2,422:
 
def ethiopian(multiplier, multiplicand):
if tutor: show_heading(multiplier, multiplicand)
def column1(x): return takewhile(lambda v: v >= 1, iterate(halve, x))
def column2(x): return iterate(double, x)
def rows(x, y): return izip(column1(x), column2(y))
if tutor: show_heading(multiplier, multiplicand)
table = rows(multiplier, multiplicand)
if tutor: table = list(table)
Anonymous user