Same as [the original](https://www.codewars.com/kata/simple-fun-number-258-is-divisible-by-6) (same rules, really, go there for example and I strongly recommend completing it first), but with more than one asterisk (but always at least one).

For example, `"*2"` should return `["12", "42", "72"]`.

Similarly, `"*2*"` should return `["024", "120", "126", "222", "228", "324", "420", "426", "522", "528", "624", "720", "726", "822", "828", "924"]`. Order matters and returning the right one is part of the challenge itself, yep!

More examples in the test codes and, of course, if you cannot generate any number divisible by 6, just return `[]` (or `[] of String` in Crystal).

Difficulty: introductory

Starter code:

def is_divisible_by_6(s):
	

Solutions:
from itertools import product

def is_divisible_by_6(s):
    if s[-1] in '13579': return []
    ss = s.replace('*','{}')
    return [ v for v in (ss.format(*p) for p in product(*(['0123456789']*s.count('*')))) if not int(v)%6]

def create_permutations(string):
    if '*' not in string:
        return [int(string)]
    return [x for i in range(10) for x in create_permutations(string.replace('*', str(i), 1))]
    

def is_divisible_by_6(string):
    return list(map(lambda x: str(x).zfill(len(string)), filter(lambda x: not x%6, create_permutations(string))))

from itertools import product

def is_divisible_by_6(s):
    return [''.join(p) for p in product(*list('0123456789' if c == '*' else c for c in s)) if int(''.join(p)) % 6 == 0]

def is_divisible_by_6(s):
    if s[-1] in "13579": return []
    l, base, step = s.count("*"), int(s.replace("*", "0")), (6 if s[-1] == "*" else 3)
    start, s = next(n for n in range(base, base + step) if n % step == 0) - base, s.replace("*", "{}")
    return [s.format(*f"{rep:0{l}d}") for rep in range(start, 10**l, step)]

def is_divisible_by_6(string):
    num_of_star = string.count('*')
    i = 0
    result = []
    num_lst = []
    while i < num_of_star:
        if i == 0:
            num_lst = [string.replace('*',str(x),1) for x in range(10)]
            i += 1
        else:
            c = num_lst[:]
            num_lst = [k.replace('*',str(x),1) for x in range(10) for k in c]
            i += 1
               
    for num in num_lst:
        
        if int(num) % 6 == 0:
            result.append(num)
    return list(sorted(result))

from itertools import product
from string import digits

def iter_candidates(s, pos):
    xs = list(s)
    for ds in product(digits, repeat=len(pos)):
        for i, d in zip(pos, ds):
            xs[i] = d
        yield ''.join(xs)
    
def is_divisible_by_6(s):
    pos = [i for i, x in enumerate(s) if x == '*']
    return [x for x in iter_candidates(s, pos) if int(x) % 6 == 0]

from itertools import product as p
def is_divisible_by_6(s):
    return [u for u in [s.replace('*','{}').format(*x) for x in list(p(range(10),repeat=s.count('*')))] if int(u)%6==0]

is_divisible_by_6=lambda s:[n for n in map(''.join,__import__('itertools').product(*(c=='*'and'0123456789'or c for c in s)))if int(n)%6<1]

is_divisible_by_6=lambda s: [] if s[-1] in "13579" else sum((is_divisible_by_6(s.replace("*",e,1)) for e in "0123456789"),[]) if s.count("*")>1 else (lambda t: [s.replace("*",str(e)) for e in range((3-t)%3,10,3) if s[-1]!="*" or not e%2])(sum(int(e) for e in s if e!="*"))

from itertools import product

def is_divisible_by_6(string):
    result = []
    n = 0
    indices = []
    for i, c in enumerate(string):
        if c == '*':
            n += 1
            indices.append(i)

    s = list(string)
    for combo in product(list(map(str, range(10))), repeat=n):
        for idx, digit in zip(indices, combo):
            s[idx] = digit
        if int(''.join(s)) % 6 == 0:
            result.append(''.join(s))
        
    return result