python list all factors of number code example
Example: python find factors of a number
def factors(n):
return set(reduce(list.__add__, \
([i, n//i] for i in range(1, int(n**0.5) + 1) if not n % i )))
def factors(n):
return set(reduce(list.__add__, \
([i, n//i] for i in range(1, int(n**0.5) + 1) if not n % i )))