math-exercises 3.0.109 → 3.0.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/calcul/addAndSubWithoutRelatives.d.ts.map +1 -1
- package/lib/exercises/math/calcul/addAndSubWithoutRelatives.js +5 -1
- package/lib/exercises/math/derivation/convexity/inflexionPointQuadrinomials.js +1 -1
- package/lib/exercises/math/limits/sequencePolynomLimit.js +2 -2
- package/lib/exercises/math/limits/sequencePolynomNoFILimit.js +2 -2
- package/lib/exercises/math/limits/sequencePolynomProductLimit.js +4 -4
- package/lib/exercises/math/limits/sequenceRationalFracLimit.js +4 -4
- package/lib/exercises/math/python/conditionIfElifElse.d.ts +1 -0
- package/lib/exercises/math/python/conditionIfElifElse.d.ts.map +1 -1
- package/lib/exercises/math/python/conditionIfElifElse.js +24 -16
- package/lib/exercises/math/python/forLoop.js +1 -1
- package/lib/exercises/math/python/inOutCalcul.d.ts.map +1 -1
- package/lib/exercises/math/python/inOutCalcul.js +5 -1
- package/lib/exercises/math/python/pyWhileLoop1Exercise.js +1 -1
- package/lib/exercises/math/python/pythonForLoopInstructionCompletion.d.ts.map +1 -1
- package/lib/exercises/math/python/pythonForLoopInstructionCompletion.js +24 -15
- package/lib/exercises/math/python/pythonRangeCompletion.d.ts.map +1 -1
- package/lib/exercises/math/python/pythonRangeCompletion.js +7 -5
- package/lib/exercises/math/python/variableAffectation.js +7 -7
- package/lib/exercises/math/python/variableType.d.ts.map +1 -1
- package/lib/exercises/math/python/variableType.js +11 -10
- package/lib/exercises/math/python/whileLoopCount.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addAndSubWithoutRelatives.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSubWithoutRelatives.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAcT,MAAM,mBAAmB,CAAC;AAG3B;;GAEG;AAEH,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"addAndSubWithoutRelatives.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSubWithoutRelatives.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAcT,MAAM,mBAAmB,CAAC;AAG3B;;GAEG;AAEH,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAmFzC,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAa3D,CAAC"}
|
|
@@ -8,7 +8,11 @@ import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
|
|
|
8
8
|
import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
|
|
9
9
|
const getInstruction = (identifiers) => {
|
|
10
10
|
const { numbers } = identifiers;
|
|
11
|
-
return `Calculer :
|
|
11
|
+
return `Calculer :
|
|
12
|
+
|
|
13
|
+
$$
|
|
14
|
+
${getStartStatement(identifiers)}
|
|
15
|
+
$$`;
|
|
12
16
|
};
|
|
13
17
|
const getAnswer = (identifiers) => {
|
|
14
18
|
const { numbers } = identifiers;
|
|
@@ -119,7 +119,7 @@ L'abscisse du point d'inflexion est donc $${inflexionPoint.toTex()}$.`;
|
|
|
119
119
|
};
|
|
120
120
|
export const inflexionPointQuadrinomials = {
|
|
121
121
|
id: "inflexionPointQuadrinomials",
|
|
122
|
-
label: "
|
|
122
|
+
label: "Calculer l'abscisse du point d'inflexion",
|
|
123
123
|
isSingleStep: true,
|
|
124
124
|
generator: (nb) => getDistinctQuestions(getInflexionPointQuadrinomialsQuestion, nb),
|
|
125
125
|
qcmTimer: 60,
|
|
@@ -4,7 +4,7 @@ import { Polynomial, PolynomialConstructor, } from "../../../math/polynomials/po
|
|
|
4
4
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
5
5
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
6
6
|
const getInstruction = (identifiers) => {
|
|
7
|
-
const poly = new Polynomial(identifiers.coeffs);
|
|
7
|
+
const poly = new Polynomial(identifiers.coeffs, "n");
|
|
8
8
|
return `Déterminer la limite de la suite $u$ définie par :
|
|
9
9
|
|
|
10
10
|
$$
|
|
@@ -13,7 +13,7 @@ $$`;
|
|
|
13
13
|
};
|
|
14
14
|
const getAnswer = (identifiers) => {
|
|
15
15
|
const to = "+\\infty";
|
|
16
|
-
const poly = new Polynomial(identifiers.coeffs);
|
|
16
|
+
const poly = new Polynomial(identifiers.coeffs, "n");
|
|
17
17
|
const answer = poly.getLimit(to);
|
|
18
18
|
return answer;
|
|
19
19
|
};
|
|
@@ -4,7 +4,7 @@ import { Polynomial, PolynomialConstructor, } from "../../../math/polynomials/po
|
|
|
4
4
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
5
5
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
6
6
|
const getInstruction = (identifiers) => {
|
|
7
|
-
const poly = new Polynomial(identifiers.coeffs);
|
|
7
|
+
const poly = new Polynomial(identifiers.coeffs, "n");
|
|
8
8
|
return `Déterminer la limite de la suite $u$ définie par :
|
|
9
9
|
|
|
10
10
|
$$
|
|
@@ -13,7 +13,7 @@ $$`;
|
|
|
13
13
|
};
|
|
14
14
|
const getAnswer = (identifiers) => {
|
|
15
15
|
const to = "+\\infty";
|
|
16
|
-
const poly = new Polynomial(identifiers.coeffs);
|
|
16
|
+
const poly = new Polynomial(identifiers.coeffs, "n");
|
|
17
17
|
const answer = poly.getLimit(to);
|
|
18
18
|
return answer;
|
|
19
19
|
};
|
|
@@ -7,8 +7,8 @@ import { randint } from "../../../math/utils/random/randint.js";
|
|
|
7
7
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
8
8
|
const getInstruction = (identifiers) => {
|
|
9
9
|
const { polyNumCoeffs, polyDenumCoeffs } = identifiers;
|
|
10
|
-
const polyNum = new Polynomial(polyNumCoeffs);
|
|
11
|
-
const polyDenum = new Polynomial(polyDenumCoeffs);
|
|
10
|
+
const polyNum = new Polynomial(polyNumCoeffs, "n");
|
|
11
|
+
const polyDenum = new Polynomial(polyDenumCoeffs, "n");
|
|
12
12
|
return `Déterminer la limite de la suite $u$ définie par :
|
|
13
13
|
|
|
14
14
|
$$
|
|
@@ -17,8 +17,8 @@ $$`;
|
|
|
17
17
|
};
|
|
18
18
|
const getAnswer = (identifiers) => {
|
|
19
19
|
const { polyNumCoeffs, polyDenumCoeffs } = identifiers;
|
|
20
|
-
const polyNum = new Polynomial(polyNumCoeffs);
|
|
21
|
-
const polyDenum = new Polynomial(polyDenumCoeffs);
|
|
20
|
+
const polyNum = new Polynomial(polyNumCoeffs, "n");
|
|
21
|
+
const polyDenum = new Polynomial(polyDenumCoeffs, "n");
|
|
22
22
|
const numLeadingCoeff = polyNum.coefficients[polyNum.degree];
|
|
23
23
|
const denumLeadingCoeff = polyDenum.coefficients[polyDenum.degree];
|
|
24
24
|
const product = new Monom(polyNum.degree + polyDenum.degree, numLeadingCoeff * denumLeadingCoeff, "n");
|
|
@@ -8,8 +8,8 @@ import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
|
8
8
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
9
9
|
const getInstruction = (identifiers) => {
|
|
10
10
|
const { numCoeffs, denumCoeffs } = identifiers;
|
|
11
|
-
const polyNum = new Polynomial(numCoeffs);
|
|
12
|
-
const polyDenum = new Polynomial(denumCoeffs);
|
|
11
|
+
const polyNum = new Polynomial(numCoeffs, "n");
|
|
12
|
+
const polyDenum = new Polynomial(denumCoeffs, "n");
|
|
13
13
|
return `Déterminer la limite de la suite $u$ définie par :
|
|
14
14
|
|
|
15
15
|
$$
|
|
@@ -18,8 +18,8 @@ $$`;
|
|
|
18
18
|
};
|
|
19
19
|
const getAnswer = (identifiers) => {
|
|
20
20
|
const { numCoeffs, denumCoeffs } = identifiers;
|
|
21
|
-
const polyNum = new Polynomial(numCoeffs);
|
|
22
|
-
const polyDenum = new Polynomial(denumCoeffs);
|
|
21
|
+
const polyNum = new Polynomial(numCoeffs, "n");
|
|
22
|
+
const polyDenum = new Polynomial(denumCoeffs, "n");
|
|
23
23
|
let answer = "";
|
|
24
24
|
const to = "+\\infty";
|
|
25
25
|
const numLeadingCoeff = polyNum.coefficients[polyNum.degree];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditionIfElifElse.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/conditionIfElifElse.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"conditionIfElifElse.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/conditionIfElifElse.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAmJF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
|
|
@@ -2,36 +2,39 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercis
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
4
4
|
import { random } from "../../../utils/alea/random.js";
|
|
5
|
+
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
5
6
|
const operations = [
|
|
6
7
|
{ name: "+", func: (x, step) => x + step },
|
|
7
8
|
{ name: "-", func: (x, step) => x - step },
|
|
8
9
|
{ name: "*", func: (x, step) => x * step },
|
|
9
10
|
{ name: "//", func: (x, step) => Math.floor(x / step) },
|
|
10
11
|
];
|
|
11
|
-
const getAnswer = ({ a, b, opName }) => {
|
|
12
|
+
const getAnswer = ({ a, b, opName, ineqs }) => {
|
|
12
13
|
const operation = operations.find((op) => op.name === opName);
|
|
13
14
|
const opresult = operation.func(a, b);
|
|
14
|
-
|
|
15
|
+
const results = [b, opresult + b, opresult + 1];
|
|
16
|
+
const unshuffledIneqs = ["<", "==", ">"];
|
|
17
|
+
const shuffledResults = unshuffledIneqs.map((e) => results[ineqs.indexOf(e)]);
|
|
15
18
|
if (opresult < b) {
|
|
16
|
-
|
|
19
|
+
return shuffledResults[0].frenchify();
|
|
17
20
|
}
|
|
18
21
|
else if (opresult === b) {
|
|
19
|
-
|
|
22
|
+
return shuffledResults[1].frenchify();
|
|
20
23
|
}
|
|
21
24
|
else {
|
|
22
|
-
|
|
25
|
+
return shuffledResults[2].frenchify();
|
|
23
26
|
}
|
|
24
|
-
return result.frenchify();
|
|
25
27
|
};
|
|
26
|
-
const getInstruction = ({ a, b, opName }) => `
|
|
27
|
-
Quel sera l'affichage du
|
|
28
|
+
const getInstruction = ({ a, b, opName, ineqs, }) => `
|
|
29
|
+
Quel sera l'affichage du script en Python suivant ?
|
|
30
|
+
|
|
28
31
|
\`\`\`python
|
|
29
32
|
a = ${a}
|
|
30
33
|
b = ${b}
|
|
31
34
|
a = a ${opName} b
|
|
32
|
-
if a
|
|
35
|
+
if a ${ineqs[0]} b:
|
|
33
36
|
a = b
|
|
34
|
-
elif a
|
|
37
|
+
elif a ${ineqs[1]} b:
|
|
35
38
|
a = a + b
|
|
36
39
|
else:
|
|
37
40
|
a = a + 1
|
|
@@ -39,17 +42,21 @@ print(a)
|
|
|
39
42
|
\`\`\`
|
|
40
43
|
`;
|
|
41
44
|
const getHint = ({ opName }) => `Calcule la valeur de $a$ avec $a = a ${opName} b$ puis applique la condition if-elif-else.`;
|
|
42
|
-
const getCorrection = ({ a, b, opName }) => {
|
|
45
|
+
const getCorrection = ({ a, b, opName, ineqs }) => {
|
|
43
46
|
const operation = operations.find((op) => op.name === opName);
|
|
44
47
|
const opresult = operation.func(a, b);
|
|
45
48
|
let branch;
|
|
46
49
|
let finalValue;
|
|
47
|
-
if (opresult < b)
|
|
48
|
-
|
|
50
|
+
if ((ineqs[0] === "<" && opresult < b) ||
|
|
51
|
+
(ineqs[0] === ">" && opresult > b) ||
|
|
52
|
+
(ineqs[0] === "==" && opresult === b)) {
|
|
53
|
+
branch = `La condition $a ${ineqs[0]} b$ est vraie $(${opresult} ${ineqs[0]} ${b})$, on exécute le bloc if donc : $a = ${b}$.`;
|
|
49
54
|
finalValue = b;
|
|
50
55
|
}
|
|
51
|
-
else if (
|
|
52
|
-
|
|
56
|
+
else if ((ineqs[1] === "<" && opresult < b) ||
|
|
57
|
+
(ineqs[1] === ">" && opresult > b) ||
|
|
58
|
+
(ineqs[1] === "==" && opresult === b)) {
|
|
59
|
+
branch = `La condition $a ${ineqs[0]} b$ est fausse mais la condition $a ${ineqs[1]} b$ est vraie $(${opresult} ${ineqs[1]} ${b})$, on exécute le bloc elif donc : $a = ${opresult} + ${b} = ${opresult + b}$.`;
|
|
53
60
|
finalValue = opresult + b;
|
|
54
61
|
}
|
|
55
62
|
else {
|
|
@@ -74,7 +81,8 @@ const getConditionIfElifElseQuestion = () => {
|
|
|
74
81
|
} while ((target === "lt" && !(opresult < b)) ||
|
|
75
82
|
(target === "eq" && !(opresult === b)) ||
|
|
76
83
|
(target === "gt" && !(opresult > b)));
|
|
77
|
-
|
|
84
|
+
const ineqs = shuffle(["<", "==", ">"]);
|
|
85
|
+
return getQuestionFromIdentifiers({ a, b, opName: operation.name, ineqs });
|
|
78
86
|
};
|
|
79
87
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
80
88
|
const question = {
|
|
@@ -30,7 +30,7 @@ const getAnswer = (identifiers) => {
|
|
|
30
30
|
return answer;
|
|
31
31
|
};
|
|
32
32
|
const getHint = (identifiers) => {
|
|
33
|
-
return `L'instruction \`for i in range(a,b)\` est une boucle dans laquelle $i$ prend d'abord la valeur $a$, puis augmente de $1$ jusqu'à atteindre $b$ (
|
|
33
|
+
return `L'instruction \`for i in range(a,b)\` est une boucle dans laquelle $i$ prend d'abord la valeur $a$, puis augmente de $1$ jusqu'à atteindre $b$ (exclu). `;
|
|
34
34
|
};
|
|
35
35
|
const getCorrection = (identifiers) => {
|
|
36
36
|
const { initialValue, step, iterations, opIndex } = identifiers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inOutCalcul.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/inOutCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAIrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;
|
|
1
|
+
{"version":3,"file":"inOutCalcul.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/inOutCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAIrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAsHF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAY7C,CAAC"}
|
|
@@ -32,7 +32,11 @@ print(a)
|
|
|
32
32
|
};
|
|
33
33
|
const getHint = (identifiers) => {
|
|
34
34
|
const { a, b, id1, id2 } = identifiers;
|
|
35
|
-
|
|
35
|
+
let divisionHint = `En Python, l'opération \`//\` est une division entière : \`a // b\` donne le quotient de la division euclidienne de \`a\` par \`b\`. Par exemple, \`20//3 = 6\`, car le quotient de la division euclidienne de $20$ par $3$ est $6$.`;
|
|
36
|
+
let corr = `Suis le script ligne par ligne, en remplaçant les variables par les valeurs qu'elles ont prises aux lignes précédentes.`;
|
|
37
|
+
if (id1 === 3 || id2 === 3)
|
|
38
|
+
return corr + "\n" + divisionHint;
|
|
39
|
+
return corr;
|
|
36
40
|
};
|
|
37
41
|
const getCorrection = (identifiers) => {
|
|
38
42
|
const { a, b, id1, id2 } = identifiers;
|
|
@@ -25,7 +25,7 @@ const getAnswer = (identifiers) => {
|
|
|
25
25
|
};
|
|
26
26
|
const getInstruction = (identifiers) => {
|
|
27
27
|
const { a, b, op } = identifiers;
|
|
28
|
-
return `Qu'affichera le script Python suivant
|
|
28
|
+
return `Qu'affichera le script en Python suivant si l'utilisateur entre $${a}$ ?
|
|
29
29
|
\`\`\`
|
|
30
30
|
a=input("Entrez un entier naturel non nul.")
|
|
31
31
|
a=int(a)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pythonForLoopInstructionCompletion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/pythonForLoopInstructionCompletion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"pythonForLoopInstructionCompletion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/pythonForLoopInstructionCompletion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAoIF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,WAAW,CAkBpE,CAAC"}
|
|
@@ -7,32 +7,32 @@ const getPropositions = (n, { answer, coeff, iterations, operation }) => {
|
|
|
7
7
|
const propositions = [];
|
|
8
8
|
addValidProp(propositions, answer, "raw");
|
|
9
9
|
tryToAddWrongProp(propositions, `\`${operation}${coeff}\``, "raw");
|
|
10
|
-
tryToAddWrongProp(propositions, `\`
|
|
10
|
+
tryToAddWrongProp(propositions, `\`a${operation}${iterations}\``, "raw");
|
|
11
11
|
tryToAddWrongProp(propositions, `\`${coeff}\``, "raw");
|
|
12
12
|
return shuffleProps(propositions, n);
|
|
13
13
|
};
|
|
14
14
|
const getAnswer = (identifiers) => {
|
|
15
|
-
return
|
|
15
|
+
return `\`a${identifiers.operation}${identifiers.coeff}\``;
|
|
16
16
|
};
|
|
17
17
|
const getInstruction = (identifiers) => {
|
|
18
18
|
let word = "";
|
|
19
19
|
const { coeff, iterations, operation } = identifiers;
|
|
20
20
|
switch (operation) {
|
|
21
21
|
case "+":
|
|
22
|
-
word =
|
|
22
|
+
word = `lui ajouter $${coeff}$ à $${iterations}$ reprises`;
|
|
23
23
|
break;
|
|
24
24
|
case "-":
|
|
25
|
-
word =
|
|
25
|
+
word = `lui soustraire $${coeff}$ à $${iterations}$ reprises`;
|
|
26
26
|
break;
|
|
27
27
|
case "*":
|
|
28
|
-
word =
|
|
28
|
+
word = `le multiplier à $${iterations}$ reprises par $${coeff}$`;
|
|
29
29
|
break;
|
|
30
30
|
case "/":
|
|
31
31
|
default:
|
|
32
|
-
word =
|
|
32
|
+
word = `le diviser à $${iterations}$ reprises par $${coeff}$`;
|
|
33
33
|
break;
|
|
34
34
|
}
|
|
35
|
-
return `On considère la fonction en Python suivante. Cette fonction doit permettre, pour un paramètre \`a\` saisi en entrée, de ${word}
|
|
35
|
+
return `On considère la fonction en Python suivante. Cette fonction doit permettre, pour un paramètre \`a\` saisi en entrée, de ${word}, puis de renvoyer le résultat du calcul.
|
|
36
36
|
|
|
37
37
|
Par quoi faut-il remplacer les trois points ?
|
|
38
38
|
|
|
@@ -63,14 +63,23 @@ x = x${fakeOperation}${fakeCoeff}
|
|
|
63
63
|
};
|
|
64
64
|
const getCorrection = (identifiers) => {
|
|
65
65
|
const { coeff, iterations, operation } = identifiers;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
let word = "";
|
|
67
|
+
switch (operation) {
|
|
68
|
+
case "+":
|
|
69
|
+
word = `ajouter $${coeff}$ à \`a\``;
|
|
70
|
+
break;
|
|
71
|
+
case "-":
|
|
72
|
+
word = `soustraire $${coeff}$ à \`a\``;
|
|
73
|
+
break;
|
|
74
|
+
case "*":
|
|
75
|
+
word = `multiplier \`a\` par $${coeff}$`;
|
|
76
|
+
break;
|
|
77
|
+
case "/":
|
|
78
|
+
default:
|
|
79
|
+
word = `diviser \`a\` par $${coeff}$`;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
return `On veut ${word} à chaque exécution de la boucle \`for\`. En python, cela se traduit par :
|
|
74
83
|
|
|
75
84
|
\`\`\`
|
|
76
85
|
a=a${operation}${coeff}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pythonRangeCompletion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/pythonRangeCompletion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"pythonRangeCompletion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/pythonRangeCompletion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAmGF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAiBvD,CAAC"}
|
|
@@ -6,6 +6,8 @@ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
|
6
6
|
const getPropositions = (n, { answer }) => {
|
|
7
7
|
const propositions = [];
|
|
8
8
|
addValidProp(propositions, answer);
|
|
9
|
+
tryToAddWrongProp(propositions, Number(answer) + 1 + "");
|
|
10
|
+
tryToAddWrongProp(propositions, Number(answer) - 1 + "");
|
|
9
11
|
while (propositions.length < n) {
|
|
10
12
|
tryToAddWrongProp(propositions, randint(1, 20).frenchify());
|
|
11
13
|
}
|
|
@@ -19,20 +21,20 @@ const getInstruction = (identifiers) => {
|
|
|
19
21
|
const { coeff, iterations, operation } = identifiers;
|
|
20
22
|
switch (operation) {
|
|
21
23
|
case "+":
|
|
22
|
-
word =
|
|
24
|
+
word = `lui ajouter $${coeff}$ à $${iterations}$ reprises`;
|
|
23
25
|
break;
|
|
24
26
|
case "-":
|
|
25
|
-
word =
|
|
27
|
+
word = `lui soustraire $${coeff}$ à $${iterations}$ reprises`;
|
|
26
28
|
break;
|
|
27
29
|
case "*":
|
|
28
|
-
word =
|
|
30
|
+
word = `le multiplier à $${iterations}$ reprises par $${coeff}$`;
|
|
29
31
|
break;
|
|
30
32
|
case "/":
|
|
31
33
|
default:
|
|
32
|
-
word =
|
|
34
|
+
word = `le diviser à $${iterations}$ reprises par $${coeff}$`;
|
|
33
35
|
break;
|
|
34
36
|
}
|
|
35
|
-
return `On considère la fonction en Python suivante. Cette fonction doit permettre, pour un paramètre \`a\` saisi en entrée, de ${word}
|
|
37
|
+
return `On considère la fonction en Python suivante. Cette fonction doit permettre, pour un paramètre \`a\` saisi en entrée, de ${word}, puis de renvoyer le résultat du calcul.
|
|
36
38
|
|
|
37
39
|
Par quoi faut-il remplacer les trois points ?
|
|
38
40
|
|
|
@@ -32,8 +32,8 @@ const getInstruction = (identifiers) => {
|
|
|
32
32
|
const { variableName, initialVariable, affines } = identifiers;
|
|
33
33
|
const affinePythonStrings = affines
|
|
34
34
|
.map((a) => a.toPython())
|
|
35
|
-
.join(
|
|
36
|
-
return `On exécute le script Python ci-dessous. Quelle est la valeur de \`${variableName}\` à la fin du script ?
|
|
35
|
+
.join(`\n${variableName} = `);
|
|
36
|
+
return `On exécute le script en Python ci-dessous. Quelle est la valeur de \`${variableName}\` à la fin du script ?
|
|
37
37
|
|
|
38
38
|
\`\`\`
|
|
39
39
|
${variableName} = ${initialVariable}
|
|
@@ -53,7 +53,7 @@ const getCorrection = (identifiers) => {
|
|
|
53
53
|
et on affecte cette valeur dans la variable \`${variableName}\`. On a donc :
|
|
54
54
|
|
|
55
55
|
\`\`\`
|
|
56
|
-
${variableName} = ${initialVariable}
|
|
56
|
+
${variableName} = ${initialVariable} # Ici ${variableName} = ${variable}
|
|
57
57
|
${affines
|
|
58
58
|
.map((a) => {
|
|
59
59
|
evVariable = a
|
|
@@ -62,8 +62,8 @@ ${affines
|
|
|
62
62
|
variable = a.calculate(variable);
|
|
63
63
|
return (`${variableName} = ` +
|
|
64
64
|
a.toPython() +
|
|
65
|
-
|
|
66
|
-
.toTex()
|
|
65
|
+
` # Ici ${variableName} = ${evVariable
|
|
66
|
+
.toTex({ forceNoSimplification: true })
|
|
67
67
|
.replace("\\times", "*")
|
|
68
68
|
.replaceAll("\\left", "")
|
|
69
69
|
.replaceAll("\\right", "")} = ${variable}\n`);
|
|
@@ -105,10 +105,10 @@ const getVariableAffectationQuestion = (ops) => {
|
|
|
105
105
|
affines.push(new Affine(1, randint(-4, 5, [0]), variableName));
|
|
106
106
|
}
|
|
107
107
|
else if (type === 2) {
|
|
108
|
-
affines.push(new Affine(randint(-4, 5, [0]), 0, variableName));
|
|
108
|
+
affines.push(new Affine(randint(-4, 5, [0, 1]), 0, variableName));
|
|
109
109
|
}
|
|
110
110
|
else {
|
|
111
|
-
affines.push(AffineConstructor.random({ min: -4, max: 4 }, { min: -5, max: 5 }, variableName));
|
|
111
|
+
affines.push(AffineConstructor.random({ min: -4, max: 4, excludes: [0, 1] }, { min: -5, max: 5, excludes: [0] }, variableName));
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
const identifiers = { variableName, initialVariable, affines };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variableType.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/variableType.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;
|
|
1
|
+
{"version":3,"file":"variableType.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/variableType.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAwGF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAkB9C,CAAC"}
|
|
@@ -7,7 +7,7 @@ const getPropositions = (n, { answer }) => {
|
|
|
7
7
|
addValidProp(propositions, answer, "raw");
|
|
8
8
|
tryToAddWrongProp(propositions, "Nombre entier", "raw");
|
|
9
9
|
tryToAddWrongProp(propositions, "Nombre flottant", "raw");
|
|
10
|
-
tryToAddWrongProp(propositions, "
|
|
10
|
+
tryToAddWrongProp(propositions, "Chaîne de caractères", "raw");
|
|
11
11
|
return shuffleProps(propositions, n);
|
|
12
12
|
};
|
|
13
13
|
const getAnswer = (identifiers) => {
|
|
@@ -19,7 +19,7 @@ const getAnswer = (identifiers) => {
|
|
|
19
19
|
return "Nombre flottant";
|
|
20
20
|
}
|
|
21
21
|
else if (vType === "str") {
|
|
22
|
-
return "
|
|
22
|
+
return "Chaîne de caractères";
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
25
|
throw new Error(`Unknown type: ${vType}`);
|
|
@@ -28,15 +28,16 @@ const getAnswer = (identifiers) => {
|
|
|
28
28
|
const getInstruction = (identifiers) => {
|
|
29
29
|
const { v, vType } = identifiers;
|
|
30
30
|
return `On exécute le script en Python ci-dessous :\n
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
|
|
32
|
+
\`\`\`python
|
|
33
|
+
v = ${vType === "str" ? `"${v}"` : v}
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
36
|
+
Quel est le type de la variable \`v\` ?
|
|
36
37
|
`;
|
|
37
38
|
};
|
|
38
39
|
const getHint = (identifiers) => {
|
|
39
|
-
return "En Python, le type d'une variable peut être : un nombre entier, un nombre flottant (c'est
|
|
40
|
+
return "En Python, le type d'une variable peut être : un nombre entier, un nombre flottant (c'est-à-dire avec une virgule) ou une chaîne de caractère (c'est-à-dire un texte).";
|
|
40
41
|
};
|
|
41
42
|
const getCorrection = (identifiers) => {
|
|
42
43
|
const { v, vType } = identifiers;
|
|
@@ -48,9 +49,9 @@ const getCorrection = (identifiers) => {
|
|
|
48
49
|
explanationType = "Nombre flottant";
|
|
49
50
|
}
|
|
50
51
|
else if (vType === "str") {
|
|
51
|
-
explanationType = "
|
|
52
|
+
explanationType = "Chaîne de caractères";
|
|
52
53
|
}
|
|
53
|
-
return `En Python, le type d'une variable peut être : un nombre entier, un nombre flottant (c'est
|
|
54
|
+
return `En Python, le type d'une variable peut être : un nombre entier, un nombre flottant (c'est-à-dire avec une virgule) ou une chaîne de caractère (c'est-à-dire un texte).
|
|
54
55
|
|
|
55
56
|
Ici, la variable \`v\` est de type ${explanationType.toLocaleLowerCase()}.`;
|
|
56
57
|
};
|
|
@@ -2,7 +2,7 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercis
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
4
4
|
const getInstruction = ({ inputValue, threshold, }) => {
|
|
5
|
-
return `On définit la fonction en Python
|
|
5
|
+
return `On définit la fonction en Python suivante :
|
|
6
6
|
|
|
7
7
|
\`\`\`python
|
|
8
8
|
def boucle(x):
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAA+B,CAAC;AACnD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
|
package/lib/playground.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAyCA,eAAO,MAAM,UAAU,YAAW,CAAC;AAEnC;;;;GAIG"}
|