Ethiopian multiplication: Difference between revisions

→‎Python: With tutor. More Functional: Consolidated if statements
(→‎{{header|Python}}: Add subheadings)
(→‎Python: With tutor. More Functional: Consolidated if statements)
Line 2,428:
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)
if tutor: show_table table = list(table)
if tutor: show_heading(multiplier, multiplicand)
show_table(table)
result = sum(q for p, q in table if not even(p))
if tutor: show_result(result)
show_result(result)
return result</lang>
 
Anonymous user