Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Lambda function with sum/list comprehension, eval "&", "|" and "^". solution in Speedy category for Multiplication Table by Phil15
checkio = lambda first, second: sum(sum(int(''.join([str(eval(a+operand+b)) for b in format(second, 'b')]),2)
for a in format(first, 'b'))
for operand in ['&','|','^'])
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio(4, 6) == 38
assert checkio(2, 7) == 28
assert checkio(7, 2) == 18
March 3, 2018
Comments: