def construction(a): question = u"Réduire :" exo = [ ] cor = [ ] solve = [a] exo.append("$$A = %s$$" %texify(solve)[0]) cor.append("\\begin{center}") cor.append("$\\begin{aligned}") cor.append("A & = %s \\\\" %texify(solve)[0]) solve = priorites(a) solve.insert(0, a) solve = texify(solve) if len(solve)>1: for e in solve[1:]: if e == solve[-1]: cor.append("A & = \\boxed{%s} \\\\" %e) else: cor.append("A & = %s \\\\" %e) cor.append("\\end{aligned}$") cor.append("\\end{center}") return (exo, cor,question)
def reduire(parametre): """Travail sur les bases du calcul littéral en quatrième""" question = "" exo = [u"Réduire, si possible, les expressions suivantes :", "\\begin{multicols}{3}\\noindent", " \\begin{enumerate}"] cor = [u"Réduire, si possible, les expressions suivantes :", "\\begin{multicols}{3}\\noindent", " \\begin{enumerate}"] for i in range(9): a = valeurs_reduire() solve = [a] exo.append("\\item $\\thenocalcul = " + texify(solve)[0] + "$") cor.append("\\item $\\thenocalcul = " + texify(solve)[0] + "$") solve = priorites(a) solve.insert(0, a) solve = texify(solve) if len(solve)>1: for e in solve[1:]: cor.append("\\[\\thenocalcul = " + e + "\\]") exo.append("\\stepcounter{nocalcul}") cor.append("\\stepcounter{nocalcul}") exo.extend([" \\end{enumerate}", "\\end{multicols}"]) cor.extend([" \\end{enumerate}", "\\end{multicols}"]) return (exo, cor, question)