| import random | |
| def exo_choice(file_name): | |
| tab = [] | |
| with open("qcm/"+file_name, 'r') as f: | |
| txt = "" | |
| for l in f : | |
| txt += l | |
| for ex in txt.split("!!!"): | |
| tab_1 = ex.split(";;") | |
| t_choix = tab_1[1].strip().split("@@") | |
| random.shuffle(t_choix) | |
| tab.append({'question':tab_1[0], 'choix':t_choix, 'reponse':tab_1[2].strip()}) | |
| return random.sample(tab, 10) | |
| def add_enonce_rep(tab_q, tab_r): | |
| txt = "" | |
| for i in range(len(tab_q)): | |
| txt += f"{tab_q[i]} : {tab_r[i]} \n" | |
| return txt | |