Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Perełky solution in Clear category for Pearls in the Box by Damian_Horna
import string
lista=[]
def rekurencyjna(marbles,step,praw):
czarne=marbles.count("b")/len(marbles)
biale=marbles.count("w")/len(marbles)
if step==1:
lista.append(praw*biale)
else:
czarna=marbles.replace("b","w",1)
biala=marbles.replace("w","b",1)
rekurencyjna(czarna,step-1,praw*czarne)
rekurencyjna(biala,step-1,praw*biale)
def checkio(marbles, step):
lista.clear()
rekurencyjna(marbles,step,1)
return round(sum(lista),2)
Oct. 30, 2016