Ethiopian multiplication: Difference between revisions
Content added Content deleted
(→{{header|Python}}: Add subheadings) |
(→Python: With tutor. More Functional: Consolidated if statements) |
||
Line 2,428: | Line 2,428: | ||
def column2(x): return iterate(double, x) |
def column2(x): return iterate(double, x) |
||
def rows(x, y): return izip(column1(x), column2(y)) |
def rows(x, y): return izip(column1(x), column2(y)) |
||
⚫ | |||
table = rows(multiplier, multiplicand) |
table = rows(multiplier, multiplicand) |
||
if tutor: |
if tutor: |
||
table = list(table) |
|||
⚫ | |||
show_table(table) |
|||
result = sum(q for p, q in table if not even(p)) |
result = sum(q for p, q in table if not even(p)) |
||
if tutor: |
if tutor: |
||
show_result(result) |
|||
return result</lang> |
return result</lang> |
||