In [1]:
f = open('consignes.txt','r')
l = f.read()
f.close()

In [2]:
import numpy as np

In [5]:
steps = [i for i in range(1,11)]

In [6]:
diff = sorted(np.random.choice(steps,10,replace=False))

In [19]:
diff


Out[19]:
[0, 3, 5, 6, 11, 13, 15, 21, 22, 24]

In [7]:
ll = list(filter(lambda x: x != '', l.split('\n')))

In [8]:
found_in = {}
for r in ll:
    if r[0] == 'W':
        nb = int(r.split(' ')[2])
        found_in[nb] = []
    else:
        w = r.split('\t')[1]
        if len(w) != 1:
            found_in[nb].append(w)

In [55]:
diff = sorted(np.random.choice(steps,10,replace=False))
l_de_mots = []
for n in diff:
    l_de_mots.append(np.random.choice(found_in[n]))
    print(l_de_mots[-1])


des
ta
un
trois
étrange
tu
vents
seule
turbulences
portrait

In [56]:
f = open('session_entrainement.txt','a')
f.write("Session d'entraînement #"+str(n_sess)+'\n')
f.write("1)Faire trouver les mots suivants (les dicter):\n")
for w in l_de_mots:
    f.write('\t'+w+'\n')
f.write("\n2)Faire épeler (spelling mode) un nom propre au choix.\n")
f.write("\n3)Poser 3 questions au choix (les reporter).\n")
f.write("\n4)Expression libre.\n\n\n")
f.close()
n_sess += 1

In [14]:
n_sess=1

In [ ]:


In [71]:
n_sess= 2