%%AMC:preprocess_command=prePythonTex4AMC
%%AMC:jobspecific=1
%%AMC:latex_engine=pdflatex --shell-escape
\documentclass{article}
\usepackage[utf8x]{inputenc}    
\usepackage[T1]{fontenc}
\usepackage{relsize,exscale} %%% redimensionnement des formules mathématiques
\usepackage{graphicx} %%% insertion d'images
\usepackage[francais,bloc]{automultiplechoice}  %%% pour l'utilisation des possibilités d'AMC
\usepackage{multicol}	%%% gestion des colonnes 
\usepackage{geometry}
\usepackage{pgf,tikz}%%%pour les graphiques
\usetikzlibrary{arrows}
\pagestyle{empty}
\usepackage{pythontex}
\usepackage{multicol}
\begin{document}
\pyc{from random import *}
\pyc{seed(12345)}




\element{qcm}{
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{questionmult}{quest1}\bareme{formula=2*NBC-NMC,p=0}
\pyc{t=randint(11,99)}
Le coefficient multiplicateur associé à une augmentation de  \py{t} \% est :
  \begin{multicols}{5}
  \begin{reponses}
     \bonne{\py{1+t/100}}
      \mauvaise{\py{t/100}}
      \mauvaise{\py{1-t/100}}
      \mauvaise{\py{t}}
      \mauvaise{\py{100-t}}
    \end{reponses}
      \end{multicols}

\explain{Augmenter de t \% revient à multiplier par 1+t/100=1+\py{t}/100=\py{1+t/100}}
\end{questionmult}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\element{qcm}{
\begin{questionmult}{quest2}\bareme{formula=2*NBC-NMC,p=0}
\pyc{t=randint(11,99)}
Le coefficient multiplicateur associé à une baisse de  \py{t} \% est :
  \begin{multicols}{5}
  \begin{reponses}
     \bonne{\py{1-t/100}}
      \mauvaise{\py{t/100}}
      \mauvaise{\py{1+t/100}}
      \mauvaise{\py{t}}
      \mauvaise{\py{100-t}}
    \end{reponses}
      \end{multicols}

\explain{Baisser de t \% revient à multiplier par 1-t/100=1-\py{t}/100=\py{1-t/100}}
\end{questionmult}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\element{qcm}{
\begin{questionmult}{quest3}\bareme{formula=2*NBC-NMC,p=0}
\pyc{a=randint(350,1000)}
\pyc{b=randint(a-300,a-50)}
Un lycée de \py{a} élèves comporte \py{b} externes. Le pourcentage d'externes est environ : 
 \begin{multicols}{5}
  \begin{reponses}
     \bonne{\py{int(b/a*100)} \%}
     \mauvaise{\py{int(a/b*100)}\%}
     \mauvaise{\py{int(b/a*120)} \%}
     \mauvaise{\py{int(b/a*80)} \%}
     \mauvaise{\py{a-b} \%}
    \end{reponses}
      \end{multicols}
\explain{Il y a \py{b} externes sur \py{a} élèves. $\frac{\py{b}}{\py{a}} \times 100 \approx \py{int(b/a*100)}$}
\end{questionmult}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\element{qcm}{
\begin{questionmult}{quest4}\bareme{formula=2*NBC-NMC,p=0}
\pyc{a=randint(500,600)}
\pyc{b=randint(300,400)}
Le nombre de bactéries étudiées dans un laboratoire passe de \py{a} millions à \py{b} millions.
On peut affirmer que le nombre de bactéries diminue environ de :
 \begin{multicols}{5}
  \begin{reponses}
     \bonne{\py{100-int(b/a*100)} \%}
     \mauvaise{\py{a-b}\%}
     \mauvaise{\py{round((b/a),2)} \%}
    \mauvaise{\py{int(b/a*80)} \%}
    \mauvaise{\py{int(b/a*100)} \%}
    \end{reponses}
      \end{multicols}
\explain{$\frac{\py{b}}{\py{a}} \approx \py{int(b/a*100)}$. Cela correspond à un baisse de \py{100-int(b/a*100)} \%}
\end{questionmult}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\element{qcm}{
\begin{questionmult}{quest5}\bareme{formula=2*NBC-NMC,p=0}
\pyc{t1=randint(20,30)}
\pyc{t2=randint(30,40)}
Si le prix d'un objet augmente de \py{t1} \% puis baisse de \py{t2} \% alors le prix de l'objet aura 
 \begin{multicols}{3}
  \begin{reponses}
     \bonne{Baissé de \py{100-(1+t1/100)*(1-t2/100)*100 }\%}
     \mauvaise{Augmenté de \py{abs(t1-t2)}\%}
     \mauvaise{Baissé de \py{abs(t1-t2)}\%}
     \mauvaise{On ne peut pas savoir}
    \mauvaise{Baissé de   \py{100-(1+t1/100)*(1+t2/100)*100} \%}
    \mauvaise{Baissé de   \py{100-(1-t1/100)*(1-t2/100)*100} \%}
    \end{reponses}
      \end{multicols}
\explain{CM1=1+\py{t1}/100=\py{1+t1/100} et CM2=1-\py{t2}/100=\py{1-t2/100}. On multiplie ces deux coefficients et on obtient CM=CM1*CM2=\py{(1+t1/100)*(1-t2/100)}. Cela représente une baisse de \py{100-(1+t1/100)*(1-t2/100)*100}\%}
\end{questionmult}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\element{qcm}{
\begin{questionmult}{quest6}\bareme{formula=2*NBC-NMC,p=0}
\pyc{t1=randint(1,99)}
\pyc{prix2=10*randint(25,75)}
Après une diminution de  \py{t1} \%, un objet coutait \py{prix2}   . Quel était environ le prix de départ ?
 \begin{multicols}{5}
  \begin{reponses}
     \bonne{\py{round(prix2/(1-t1/100),0)}  euros}
     \mauvaise{\py{round(prix2*(1-t1/100),0)}  euros}
     \mauvaise{\py{round(prix2*(1+t1/100),0)}  euros}
     \mauvaise{\py{prix2-t1}   euros}
     \mauvaise{\py{prix2-t1/100}   euros}
    \end{reponses}
      \end{multicols}
\explain{Le CM lié à une baisse de \py{t1} \% est \py{1-t1/100}. Pour compenser cette baisse, il faut diviser \py{prix2} par \py{1-t1/100}. On obtient \py{round(prix2/(1-t1/100),0)}  euros  }
\end{questionmult}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\element{qcm}{
\begin{questionmult}{quest7}\bareme{formula=2*NBC-NMC,p=0}
\pyc{t1=randint(5,10)}
\pyc{an=randint(4,7)}
Pendant \py{an} années consécutives, la population d'une ville a baissé de \py{t1} \%. Globalement, elle aura donc baissé environ de
 \begin{multicols}{5}
  \begin{reponses}
     \bonne{\py{round(100-100*((1-t1/100)**an),2)} \%}
     \mauvaise{\py{100-round(100-100*((1-t1/100)**an),2)} \%}
     \mauvaise{\py{round(120-120*((1-t1/120)**an),2)} \%}
     \mauvaise{\py{round(80-80*((1-t1/80)**an),2)} \%}
     \mauvaise{\py{an*t1}\%}
    
    \end{reponses}
      \end{multicols}
\explain{Le coefficient multiplicateur associé à une baisse de \py{t1} \% est \py{1-t1/100}. On va donc multiplier \py{an} fois par \py{1-t1/100}, c'est à dire par ${\py{1-t1/100}}^{\py{an}} \approx \py{round(((1-t1/100)**an),2)} $. Cela correspond à une baisse de \py{round(100-100*((1-t1/100)**an),2)} \%}
\end{questionmult}
}









%%% nombre d'exemplaires souhaité : 
\exemplaire{36}{    
%%% remise à zéro des numéros de figure pour chaque exemplaire
\setcounter{figure}{0}
%%% Identification codée de l'élève (cases à cocher à gauche)
\noindent{\setlength{\parindent}{0pt}\hspace*{\fill}\AMCcode{etu}{2}\hspace*{\fill}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Partie à droite des cases à cocher pour les numéros des élèves
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{minipage}[b]{12 cm}
%%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\centering\large\bf Pourcentage
%% intitulé
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\hspace{1ex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Cadre d'Identification nominative de l'élève
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%$\longleftarrow{}$\hspace{0pt plus 1cm} Codez votre numéro d'élève ci-contre.
\vspace{1ex}
\hfill\champnom{\fbox{    
   \begin{minipage}{.9\linewidth}
      Nom et prénom :
      
      \vspace*{.5cm}\dotfill
      
      \vspace*{1mm}
    \end{minipage}
  }}\hfill\vspace{1ex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Consignes particulières
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	\vspace*{1mm}
%%% intitulé
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	    
\begin{small}
Une réponse juste apporte des points, une réponse fausse en enlève.\\ L'absence de réponse ne rapporte ni n'enlève aucun point.\\
Les questions avec \multiSymbole{} peuvent avoir 0, 1 ou plusieurs bonnes réponses.
\end{small}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	\vspace{1ex}
\end{minipage}\hspace*{\fill}
%%% saut de ligne de taille 1mm :
\vspace{1cm}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% creation du qcm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\melangegroupe{qcm}
\restituegroupe{qcm}
\clearpage    
}   
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
