def t1(l1,l2):
for a in range(0,len(l1)):
for b in range(0,len(l2)):
if l1[a]==l2[b]:
return True
return False
def t2(mots):
t=[]
for a in range(0,len(mots)):
if len(mots[a])>1 and mots[a][0]==mots[a][-1]:
t.append(mots[a])
return t
def t3(set1,set2):
n1=sorted(set1-set2)
n2=sorted(set2-set1)
return f'La différence pour set1 c est {n1} et pour set2 c est {n2}'
def t4(d):
t=0
for a in d.values:
t+=a
d['nouveau']=31
return d
def t5(n):
t=0
for a in range(1,7):
for b in range(1,7):
if a+b==n:
t+=1
return t
def t6(n):
t=0
for a in range(1,7):
for b in range(1,7):
for c in range(1,7):
if a+b+c==n:
t+=1
return t
def lancer(n,r):
t=[None]*r
for a in reversed(range(len(t))):
t[a]=n//(6**a)+1
n-=(t[a]-1)*6**a
return t
def t7():
nbd=int(input('Nombre de dés [2 .. 8] :'))
s=int(input(f'Entrez un nombre entier [{nbd} .. {nbd*6}] :'))
tot=0
for a in range(1,6**nbd+1):
t=lancer(a,nbd+1)
to=0
for b in range(0,len(t)):
to+=t[b]
if to==s:
tot+=1
print(f'Il y a {tot} façon de faire {s} avec {nbd} dés.')
t7()
To embed this project on your website, copy the following code and paste it into your website's HTML: