Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Two ways solution in Clear category for Digits Multiplication by rossras
from operator import mul
from functools import reduce
# version 1: gettin' fancy with filter, map, and reduce
def checkio(number: int) -> int:
return reduce(mul, map(int, filter(lambda x: x!='0', str(number))))
# version 2: equivalent to version 1, but easier to read and faster
def checkio(number: int) -> int:
result = 1
for ch in str(number):
if ch != '0':
result *= int(ch)
return result
April 3, 2020