math-exercises 3.0.72 → 3.0.73

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.
Files changed (181) hide show
  1. package/lib/exercises/exercise.d.ts +3 -1
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.d.ts +9 -0
  4. package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.d.ts.map +1 -0
  5. package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.js +114 -0
  6. package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.d.ts +8 -0
  7. package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.d.ts.map +1 -0
  8. package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.js +152 -0
  9. package/lib/exercises/math/calcul/arithmetics/index.d.ts +9 -0
  10. package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
  11. package/lib/exercises/math/calcul/arithmetics/index.js +9 -0
  12. package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.d.ts +15 -0
  13. package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.d.ts.map +1 -0
  14. package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.js +143 -0
  15. package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.d.ts +9 -0
  16. package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.d.ts.map +1 -0
  17. package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.js +111 -0
  18. package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.d.ts +10 -0
  19. package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.d.ts.map +1 -0
  20. package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.js +133 -0
  21. package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.d.ts +9 -0
  22. package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.d.ts.map +1 -0
  23. package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.js +117 -0
  24. package/lib/exercises/math/calcul/arithmetics/minNumberInequality.d.ts +13 -0
  25. package/lib/exercises/math/calcul/arithmetics/minNumberInequality.d.ts.map +1 -0
  26. package/lib/exercises/math/calcul/arithmetics/minNumberInequality.js +192 -0
  27. package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.d.ts +7 -0
  28. package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.d.ts.map +1 -0
  29. package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.js +84 -0
  30. package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.d.ts +8 -0
  31. package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.d.ts.map +1 -0
  32. package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.js +107 -0
  33. package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
  34. package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.js +37 -0
  35. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
  36. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.js +57 -6
  37. package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -1
  38. package/lib/exercises/math/calcul/fractions/fractionsOperations.js +64 -22
  39. package/lib/exercises/math/calcul/fractions/fractionsSubstraction.d.ts.map +1 -1
  40. package/lib/exercises/math/calcul/fractions/fractionsSubstraction.js +143 -4
  41. package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
  42. package/lib/exercises/math/calcul/fractions/fractionsSum.js +141 -3
  43. package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
  44. package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
  45. package/lib/exercises/math/calcul/fractions/index.js +1 -0
  46. package/lib/exercises/math/calcul/fractions/periodicWritingToFraction.js +3 -3
  47. package/lib/exercises/math/calcul/fractions/powerNotation.d.ts +9 -0
  48. package/lib/exercises/math/calcul/fractions/powerNotation.d.ts.map +1 -0
  49. package/lib/exercises/math/calcul/fractions/powerNotation.js +125 -0
  50. package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
  51. package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +29 -5
  52. package/lib/exercises/math/calcul/sign/absoluteNumber.d.ts +7 -0
  53. package/lib/exercises/math/calcul/sign/absoluteNumber.d.ts.map +1 -0
  54. package/lib/exercises/math/calcul/sign/absoluteNumber.js +80 -0
  55. package/lib/exercises/math/calcul/sign/index.d.ts +1 -0
  56. package/lib/exercises/math/calcul/sign/index.d.ts.map +1 -1
  57. package/lib/exercises/math/calcul/sign/index.js +1 -0
  58. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts.map +1 -1
  59. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.js +67 -21
  60. package/lib/exercises/math/calculLitteral/equation/equa3.d.ts.map +1 -1
  61. package/lib/exercises/math/calculLitteral/equation/equa3.js +0 -2
  62. package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.d.ts.map +1 -1
  63. package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.js +53 -9
  64. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts +9 -0
  65. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts.map +1 -0
  66. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.js +145 -0
  67. package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -0
  68. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  69. package/lib/exercises/math/calculLitteral/equation/index.js +1 -0
  70. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.d.ts.map +1 -1
  71. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.js +32 -4
  72. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
  73. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +30 -2
  74. package/lib/exercises/math/calculLitteral/inequations/index.d.ts +1 -0
  75. package/lib/exercises/math/calculLitteral/inequations/index.d.ts.map +1 -1
  76. package/lib/exercises/math/calculLitteral/inequations/index.js +1 -0
  77. package/lib/exercises/math/calculLitteral/inequations/inequationsSign.d.ts +9 -0
  78. package/lib/exercises/math/calculLitteral/inequations/inequationsSign.d.ts.map +1 -0
  79. package/lib/exercises/math/calculLitteral/inequations/inequationsSign.js +75 -0
  80. package/lib/exercises/math/calculLitteral/inequations/inverseInequality.d.ts +9 -0
  81. package/lib/exercises/math/calculLitteral/inequations/inverseInequality.d.ts.map +1 -0
  82. package/lib/exercises/math/calculLitteral/inequations/inverseInequality.js +120 -0
  83. package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.d.ts.map +1 -1
  84. package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.js +43 -1
  85. package/lib/exercises/math/curve/index.d.ts +3 -0
  86. package/lib/exercises/math/curve/index.d.ts.map +1 -0
  87. package/lib/exercises/math/curve/index.js +2 -0
  88. package/lib/exercises/math/curve/sqrtCurvePoint.d.ts +8 -0
  89. package/lib/exercises/math/curve/sqrtCurvePoint.d.ts.map +1 -0
  90. package/lib/exercises/math/curve/sqrtCurvePoint.js +132 -0
  91. package/lib/exercises/math/curve/squareCurvePoint.d.ts +8 -0
  92. package/lib/exercises/math/curve/squareCurvePoint.d.ts.map +1 -0
  93. package/lib/exercises/math/curve/squareCurvePoint.js +133 -0
  94. package/lib/exercises/math/functions/absolute/index.d.ts +2 -0
  95. package/lib/exercises/math/functions/absolute/index.d.ts.map +1 -1
  96. package/lib/exercises/math/functions/absolute/index.js +2 -0
  97. package/lib/exercises/math/functions/absolute/removeAbsNotation.d.ts +8 -0
  98. package/lib/exercises/math/functions/absolute/removeAbsNotation.d.ts.map +1 -0
  99. package/lib/exercises/math/functions/absolute/removeAbsNotation.js +105 -0
  100. package/lib/exercises/math/functions/absolute/removeAbsNotationSign.d.ts +8 -0
  101. package/lib/exercises/math/functions/absolute/removeAbsNotationSign.d.ts.map +1 -0
  102. package/lib/exercises/math/functions/absolute/removeAbsNotationSign.js +108 -0
  103. package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
  104. package/lib/exercises/math/functions/affines/affineExpressionReading.js +36 -0
  105. package/lib/exercises/math/functions/basics/index.d.ts +1 -0
  106. package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
  107. package/lib/exercises/math/functions/basics/index.js +1 -0
  108. package/lib/exercises/math/functions/basics/valueTableCompletion.d.ts +7 -0
  109. package/lib/exercises/math/functions/basics/valueTableCompletion.d.ts.map +1 -0
  110. package/lib/exercises/math/functions/basics/valueTableCompletion.js +78 -0
  111. package/lib/exercises/math/functions/cube/imageOfCubeFunction.d.ts +8 -0
  112. package/lib/exercises/math/functions/cube/imageOfCubeFunction.d.ts.map +1 -0
  113. package/lib/exercises/math/functions/cube/imageOfCubeFunction.js +142 -0
  114. package/lib/exercises/math/functions/cube/index.d.ts +1 -0
  115. package/lib/exercises/math/functions/cube/index.d.ts.map +1 -1
  116. package/lib/exercises/math/functions/cube/index.js +1 -0
  117. package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.d.ts +8 -0
  118. package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.d.ts.map +1 -0
  119. package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.js +128 -0
  120. package/lib/exercises/math/functions/square/index.d.ts +1 -0
  121. package/lib/exercises/math/functions/square/index.d.ts.map +1 -1
  122. package/lib/exercises/math/functions/square/index.js +1 -0
  123. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
  124. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +32 -2
  125. package/lib/exercises/math/index.d.ts +1 -0
  126. package/lib/exercises/math/index.d.ts.map +1 -1
  127. package/lib/exercises/math/index.js +1 -0
  128. package/lib/exercises/math/powers/decimalToScientific.d.ts.map +1 -1
  129. package/lib/exercises/math/powers/decimalToScientific.js +0 -1
  130. package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
  131. package/lib/exercises/math/powers/powersMixOperations.js +0 -1
  132. package/lib/exercises/math/probaStat/ballsBasicProbas.d.ts.map +1 -1
  133. package/lib/exercises/math/probaStat/ballsBasicProbas.js +1 -3
  134. package/lib/exercises/math/python/index.d.ts +2 -0
  135. package/lib/exercises/math/python/index.d.ts.map +1 -1
  136. package/lib/exercises/math/python/index.js +2 -0
  137. package/lib/exercises/math/python/pyIfElseCondition.d.ts +8 -0
  138. package/lib/exercises/math/python/pyIfElseCondition.d.ts.map +1 -0
  139. package/lib/exercises/math/python/pyIfElseCondition.js +133 -0
  140. package/lib/exercises/math/python/variableType.d.ts +8 -0
  141. package/lib/exercises/math/python/variableType.d.ts.map +1 -0
  142. package/lib/exercises/math/python/variableType.js +118 -0
  143. package/lib/exercises/math/python/whileLoop.js +1 -1
  144. package/lib/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.d.ts.map +1 -1
  145. package/lib/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.js +1 -0
  146. package/lib/exercises/math/sequences/arithmetic/arithmeticFindReason.d.ts.map +1 -1
  147. package/lib/exercises/math/sequences/arithmetic/arithmeticFindReason.js +2 -1
  148. package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
  149. package/lib/exercises/math/sets/intervals/inequalityToInterval.js +21 -0
  150. package/lib/exercises/math/sets/intervals/intervalToInequality.d.ts.map +1 -1
  151. package/lib/exercises/math/sets/intervals/intervalToInequality.js +20 -0
  152. package/lib/exercises/math/sets/intervals/intervalsUnion.d.ts.map +1 -1
  153. package/lib/exercises/math/sets/intervals/intervalsUnion.js +19 -0
  154. package/lib/exercises/math/sets/setBelonging.d.ts.map +1 -1
  155. package/lib/exercises/math/sets/setBelonging.js +24 -0
  156. package/lib/exercises/pc/chemicalElements/weightPercent.d.ts.map +1 -1
  157. package/lib/exercises/pc/chemicalElements/weightPercent.js +0 -1
  158. package/lib/exercises/utils/getDistinctQuestions.d.ts.map +1 -1
  159. package/lib/exercises/utils/getDistinctQuestions.js +6 -0
  160. package/lib/index.d.ts +71 -0
  161. package/lib/index.d.ts.map +1 -1
  162. package/lib/latexTester.d.ts.map +1 -1
  163. package/lib/latexTester.js +5 -2
  164. package/lib/math/numbers/decimals/decimal.d.ts +1 -1
  165. package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
  166. package/lib/math/numbers/decimals/decimal.js +5 -2
  167. package/lib/playground.js +5 -7
  168. package/lib/tests/pdfExo.test.d.ts.map +1 -1
  169. package/lib/tests/pdfExo.test.js +2 -2
  170. package/lib/tests/pdfs/mdCodeToLatex.d.ts.map +1 -1
  171. package/lib/tests/pdfs/mdCodeToLatex.js +10 -0
  172. package/lib/tests/pdfs/quizPdfPreambule.js +1 -1
  173. package/lib/tree/nodes/algebraicNode.d.ts +2 -0
  174. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  175. package/lib/tree/nodes/nodeConstructor.js +1 -1
  176. package/lib/tree/nodes/numbers/numberNode.js +2 -2
  177. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  178. package/lib/tree/nodes/operators/fractionNode.js +10 -4
  179. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  180. package/lib/tree/nodes/operators/powerNode.js +4 -0
  181. package/package.json +1 -1
@@ -0,0 +1,128 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
4
+ import { gcd } from "../../../../math/utils/arithmetic/gcd.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
7
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
8
+ import { isNumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
9
+ import { frac, isFractionNode, } from "../../../../tree/nodes/operators/fractionNode.js";
10
+ import { isPowerNode, square } from "../../../../tree/nodes/operators/powerNode.js";
11
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
12
+ import { random } from "../../../../utils/alea/random.js";
13
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
14
+ const getPropositions = (n, { answer }) => {
15
+ const propositions = [];
16
+ addValidProp(propositions, answer);
17
+ while (propositions.length < n) {
18
+ const randomNumber = randint(0, 100);
19
+ const randomNumberNode = randomNumber.toTree();
20
+ const randomNumberSquare = square(randomNumberNode);
21
+ const randomFraction = RationalConstructor.randomIrreductible().toTree();
22
+ const choices = [randomNumberNode, randomNumberSquare, randomFraction];
23
+ const randomChoice = random(choices);
24
+ tryToAddWrongProp(propositions, randomChoice.toTex());
25
+ }
26
+ return shuffleProps(propositions, n);
27
+ };
28
+ const getAnswer = (identifiers) => {
29
+ const { a } = identifiers;
30
+ const sqrtNode = sqrt(reifyAlgebraic(a));
31
+ const x = sqrtNode.simplify().toTex();
32
+ return x;
33
+ };
34
+ const getInstruction = (identifiers) => {
35
+ const { a } = identifiers;
36
+ return `Déterminer l'image de $${reifyAlgebraic(a).toTex()}$ par la fonction racine carrée.`;
37
+ };
38
+ const getHint = (identifiers) => {
39
+ const { a } = identifiers;
40
+ return `Quel est le nombre qui, multiplié par lui-même, donne $${reifyAlgebraic(a).toTex()}$ ?`;
41
+ };
42
+ const getCorrection = (identifiers) => {
43
+ const { a } = identifiers;
44
+ const aNode = reifyAlgebraic(a);
45
+ const tex = aNode.toTex();
46
+ const answer = getAnswer(identifiers);
47
+ switch (true) {
48
+ case isNumberNode(aNode):
49
+ return `On remarque que $${tex} = ${answer}^2$.
50
+
51
+ Ici on a donc $\\sqrt{${tex}} = ${answer}$.`;
52
+ case isPowerNode(aNode):
53
+ return `On sait que $\\sqrt{x^2} = |x|$.
54
+
55
+ Ici on a donc $\\sqrt{${tex}} = ${answer}$.`;
56
+ case isFractionNode(aNode):
57
+ return `On sait que $\\sqrt{\\frac{a}{b}} = \\frac{\\sqrt{a}}{\\sqrt{b}}$.
58
+
59
+ Ici on a donc $\\sqrt{${tex}} = ${answer}$.`;
60
+ default:
61
+ throw new Error(`getCorrection: nœud inattendu rencontré (${aNode.constructor.name})`);
62
+ }
63
+ };
64
+ const getKeys = (identifiers) => {
65
+ return [];
66
+ };
67
+ const isAnswerValid = (ans, { answer }) => {
68
+ try {
69
+ const ansNode = parseAlgebraic(ans);
70
+ const answerNode = parseAlgebraic(answer);
71
+ if (!isNumberNode(ansNode) && !isFractionNode(ansNode))
72
+ return false;
73
+ return ansNode.simplify().equals(answerNode.simplify());
74
+ }
75
+ catch (err) {
76
+ return handleVEAError(err);
77
+ }
78
+ };
79
+ const getGetImageOfSquareRootFunctionQuestion = (ops) => {
80
+ const xTreeValue = randint(1, 11) ** 2;
81
+ const xTree = xTreeValue.toTree();
82
+ const randomIntTree = randint(1, 100).toTree();
83
+ let denom = randint(2, 10);
84
+ let numer = randint(1, 10);
85
+ while (gcd(numer, denom) !== 1) {
86
+ denom = randint(2, 10);
87
+ numer = randint(1, 10);
88
+ }
89
+ const fractionTree = frac(numer ** 2, denom ** 2);
90
+ const candidates = [randomIntTree, fractionTree];
91
+ const chosenInputTree = candidates[randint(0, candidates.length)];
92
+ const squaredTree = square(chosenInputTree);
93
+ const choices = [
94
+ xTree.toIdentifiers(),
95
+ squaredTree.toIdentifiers(),
96
+ fractionTree.toIdentifiers(),
97
+ ];
98
+ const a = random(choices);
99
+ return getQuestionFromIdentifiers({ a });
100
+ };
101
+ const getQuestionFromIdentifiers = (identifiers) => {
102
+ return {
103
+ answer: getAnswer(identifiers),
104
+ instruction: getInstruction(identifiers),
105
+ keys: getKeys(identifiers),
106
+ answerFormat: "tex",
107
+ identifiers,
108
+ hint: getHint(identifiers),
109
+ correction: getCorrection(identifiers),
110
+ };
111
+ };
112
+ export const getImageOfSquareRootFunction = {
113
+ id: "getImageOfSquareRootFunction",
114
+ label: "Calculer une image par la fonction racine carrée",
115
+ isSingleStep: true,
116
+ generator: (nb, opts) => getDistinctQuestions(() => getGetImageOfSquareRootFunctionQuestion(opts), nb),
117
+ qcmTimer: 60,
118
+ freeTimer: 60,
119
+ getPropositions,
120
+ isAnswerValid,
121
+ subject: "Mathématiques",
122
+ getInstruction,
123
+ getHint,
124
+ getCorrection,
125
+ getAnswer,
126
+ getQuestionFromIdentifiers,
127
+ hasHintAndCorrection: true,
128
+ };
@@ -1,2 +1,3 @@
1
1
  export * from "./squareImageInterval.js";
2
+ export * from "./getImageOfSquareRootFunction.js";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/square/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/square/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC"}
@@ -1 +1,2 @@
1
1
  export * from "./squareImageInterval.js";
2
+ export * from "./getImageOfSquareRootFunction.js";
@@ -1 +1 @@
1
- {"version":3,"file":"pythagoreOrThales.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidian/pythagoreOrThales.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAkBtC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IAEzB,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,OAAO,EAAE,MAAM,EAAE,CAAC;CAQnB,CAAC;AAoNF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAsBnD,CAAC"}
1
+ {"version":3,"file":"pythagoreOrThales.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidian/pythagoreOrThales.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAkBtC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IAEzB,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,OAAO,EAAE,MAAM,EAAE,CAAC;CAQnB,CAAC;AAqPF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAuBnD,CAAC"}
@@ -55,8 +55,37 @@ const getInstruction = (identifiers) => {
55
55
 
56
56
  Pour ${instruction}, il faut utiliser... `;
57
57
  };
58
- // const getHint: GetHint<Identifiers> = (identifiers) => {};
59
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
58
+ // const getHint: GetHint<Identifiers> = (identifiers) => {
59
+ // return `Voici les énoncés des théorèmes de Pythagore et de Thalès, et leurs réciproques :
60
+ // - **Théorème de Pythagore** : Dans un triangle rectangle, le carré de l'hypoténuse est égal à la somme des carrés des deux autres côtés.
61
+ // - **Réciproque du théorème de Pythagore** : Si dans un triangle, le carré de l'hypoténuse est égal à la somme des carrés des deux autres côtés, alors le triangle est rectangle.
62
+ // - **Théorème de Thalès** : Soit un triangle $ABC$, et $D$ un point sur la droite $(AB)$ et $E$ un point sur la droite $(AC)$. Si les droites $(DE)$ et $(BC)$ sont parallèles, alors :
63
+ // $$
64
+ // \\frac{AD}{AB}=\\frac{AE}{AC}=\\frac{DE}{BC}
65
+ // $$
66
+ // - **Réciproque du théorème de Thalès** : Soit un triangle $ABC$, et $D$ un point sur la droite $(AB)$ et $E$ un point sur la droite $(AC)$. Si $\\frac{AD}{AB}=\\frac{AE}{AC}$, alors les droites $(AB)$ et $(AC)$ sont parallèles.`;
67
+ // };
68
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
69
+ // const { isAskingLength, pointsIdentifiers, isSegmentHeight } = identifiers;
70
+ // const points = pointsIdentifiers.map((p) =>
71
+ // PointConstructor.fromIdentifiers(p),
72
+ // );
73
+ // if (isSegmentHeight) {
74
+ // if(isAskingLength){
75
+ // // ("Pythagore");
76
+ // return ``
77
+ // } else {
78
+ // // ("Recip pythagore");
79
+ // }
80
+ // } else {
81
+ // if (isAskingLength) {
82
+ // // ("Thales");
83
+ // } else {
84
+ // // ("Recip thales");
85
+ // }
86
+ // }
87
+ // return ``;
88
+ // };
60
89
  const getGGBOptions = (identifiers) => {
61
90
  const { isAskingLength, lengths, pointsIdentifiers, isSegmentHeight } = identifiers;
62
91
  const points = pointsIdentifiers.map((p) => PointConstructor.fromIdentifiers(p));
@@ -198,6 +227,7 @@ export const pythagoreOrThales = {
198
227
  shouldSpreadPropositions: true,
199
228
  },
200
229
  getQuestionFromIdentifiers,
230
+ // hasHintAndCorrection: true,
201
231
  };
202
232
  const getSubTriangle = ({ triangle, insidePointsNames, ratio, isPapillon, }) => {
203
233
  const [A, B, C] = triangle.points;
@@ -3,6 +3,7 @@ export * from "./calculLitteral/index.js";
3
3
  export * from "./combinatory/index.js";
4
4
  export * from "./complex/index.js";
5
5
  export * from "./conversion/index.js";
6
+ export * from "./curve/index.js";
6
7
  export * from "./derivation/index.js";
7
8
  export * from "./equaDiff/index.js";
8
9
  export * from "./functions/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/math/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/math/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC"}
@@ -3,6 +3,7 @@ export * from "./calculLitteral/index.js";
3
3
  export * from "./combinatory/index.js";
4
4
  export * from "./complex/index.js";
5
5
  export * from "./conversion/index.js";
6
+ export * from "./curve/index.js";
6
7
  export * from "./derivation/index.js";
7
8
  export * from "./equaDiff/index.js";
8
9
  export * from "./functions/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"decimalToScientific.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/decimalToScientific.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,QAAQ,EAgBT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAwIF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAerD,CAAC"}
1
+ {"version":3,"file":"decimalToScientific.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/decimalToScientific.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,QAAQ,EAgBT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAoIF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAerD,CAAC"}
@@ -104,7 +104,6 @@ const isAnswerValid = (ans, { decimal }) => {
104
104
  return false;
105
105
  if (parsed.rightChild.leftChild.value !== 10)
106
106
  return false;
107
- console.log(parsed.simplify({ calculatePowers: true }).toTex(), decimal.frenchify());
108
107
  return (parsed.simplify({ calculatePowers: true }).toTex() ===
109
108
  decimal.frenchify());
110
109
  }
@@ -1 +1 @@
1
- {"version":3,"file":"powersMixOperations.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/powersMixOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAwBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AA2KF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
1
+ {"version":3,"file":"powersMixOperations.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/powersMixOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAwBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AA0KF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
@@ -27,7 +27,6 @@ const getPropositions = (n, { answer, ...identifiers }) => {
27
27
  return shuffleProps(propositions, n);
28
28
  };
29
29
  const getAnswer = (identifiers) => {
30
- const statement = getStatementNode(identifiers);
31
30
  const { a, b, k, l, m, n } = identifiers;
32
31
  if (a !== b) {
33
32
  const pow = k + l * m;
@@ -1 +1 @@
1
- {"version":3,"file":"ballsBasicProbas.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/ballsBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAoGF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAgBlD,CAAC"}
1
+ {"version":3,"file":"ballsBasicProbas.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/ballsBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAoGF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
@@ -83,10 +83,8 @@ const isAnswerValid = (ans, { colorAskedIndex, repartitions, answer }) => {
83
83
  export const ballsBasicProbas = {
84
84
  id: "ballsBasicProbas",
85
85
  connector: "=",
86
- label: "Calcul de probabilité simple avec des boules colorés",
87
- levels: ["5ème", "4ème", "3ème", "2ndPro", "2nde", "CAP"],
86
+ label: "Calcul de probabilité simple avec des boules colorées",
88
87
  isSingleStep: true,
89
- sections: ["Probabilités"],
90
88
  generator: (nb) => getDistinctQuestions(getBallsBasicProbasQuestion, nb),
91
89
  qcmTimer: 60,
92
90
  freeTimer: 60,
@@ -6,4 +6,6 @@ export * from "./whileLoop.js";
6
6
  export * from "./pythonFunctionTrinom.js";
7
7
  export * from "./conditionIf.js";
8
8
  export * from "./pyNestedForLoopExercise.js";
9
+ export * from "./pyIfElseCondition.js";
10
+ export * from "./variableType.js";
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC"}
@@ -6,3 +6,5 @@ export * from "./whileLoop.js";
6
6
  export * from "./pythonFunctionTrinom.js";
7
7
  export * from "./conditionIf.js";
8
8
  export * from "./pyNestedForLoopExercise.js";
9
+ export * from "./pyIfElseCondition.js";
10
+ export * from "./variableType.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ isCondition: boolean;
4
+ inputValue: number;
5
+ };
6
+ export declare const pyIfElseCondition: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=pyIfElseCondition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pyIfElseCondition.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/pyIfElseCondition.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA2IF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
@@ -0,0 +1,133 @@
1
+ import { addValidProp, tryToAddWrongProp, shuffleProps, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randint } from "../../../math/utils/random/randint.js";
4
+ import { coinFlip } from "../../../utils/alea/coinFlip.js";
5
+ const getInstruction = ({ isCondition, inputValue, }) => {
6
+ if (isCondition) {
7
+ return `On définit la fonction en Python suivante :
8
+
9
+ \`\`\`python
10
+ def condition(x):
11
+ if x > 10:
12
+ return x + 3
13
+ else:
14
+ return 2 * x
15
+ \`\`\`
16
+
17
+ Que renvoie la commande condition($${inputValue}$) ?`;
18
+ }
19
+ else {
20
+ return `On définit la fonction en Python suivante :
21
+
22
+ \`\`\`python
23
+ def alter(a):
24
+ if a < 2:
25
+ return 2 * a
26
+ elif a >= 2 and a < 5:
27
+ return a ** 2
28
+ else:
29
+ return a + 5
30
+ \`\`\`
31
+
32
+ Que renvoie la commande alter($${inputValue}$) ?`;
33
+ }
34
+ };
35
+ const getAnswer = ({ isCondition, inputValue }) => {
36
+ let result;
37
+ if (isCondition) {
38
+ result = inputValue > 10 ? inputValue + 3 : 2 * inputValue;
39
+ }
40
+ else {
41
+ if (inputValue < 2)
42
+ result = 2 * inputValue;
43
+ else if (inputValue < 5)
44
+ result = inputValue ** 2;
45
+ else
46
+ result = inputValue + 5;
47
+ }
48
+ return result.frenchify();
49
+ };
50
+ const getHint = ({ isCondition }) => {
51
+ return isCondition
52
+ ? "Si $x > 10$, la fonction retourne $x + 3$ ; sinon elle retourne $2 \\times x$."
53
+ : "Regarde les trois cas : $a < 2$, $2 \\leq a < 5$, puis $a \\geq 5$. Chaque cas retourne une expression différente.";
54
+ };
55
+ const getCorrection = ({ isCondition, inputValue, }) => {
56
+ let exp = `On appelle la fonction avec $${inputValue}$.\n`;
57
+ if (isCondition) {
58
+ if (inputValue > 10) {
59
+ exp += `Comme $${inputValue} > 10$, on renvoie $${inputValue} + 3 = ${inputValue + 3}$.`;
60
+ }
61
+ else {
62
+ exp += `Comme $${inputValue} \\leq 10$, on renvoie $2 \\times ${inputValue} = ${2 * inputValue}$.`;
63
+ }
64
+ }
65
+ else {
66
+ if (inputValue < 2) {
67
+ exp += `Comme $${inputValue} < 2$, on renvoie $2 \\times ${inputValue} = ${2 * inputValue}$.`;
68
+ }
69
+ else if (inputValue < 5) {
70
+ exp += `Comme $2 \\leq ${inputValue} < 5$, on renvoie $${inputValue}^2 = ${inputValue ** 2}$.`;
71
+ }
72
+ else {
73
+ exp += `Comme $${inputValue} \\geq 5$, on renvoie $${inputValue} + 5 = ${inputValue + 5}$.`;
74
+ }
75
+ }
76
+ return exp;
77
+ };
78
+ const getQuestionFromIdentifiers = (identifiers) => {
79
+ const question = {
80
+ instruction: getInstruction(identifiers),
81
+ answer: getAnswer(identifiers),
82
+ hint: getHint(identifiers),
83
+ correction: getCorrection(identifiers),
84
+ keys: [],
85
+ answerFormat: "tex",
86
+ identifiers,
87
+ };
88
+ return question;
89
+ };
90
+ const getPyIfElseConditionQuestion = () => {
91
+ const isCondition = coinFlip();
92
+ const inputValue = randint(0, 15);
93
+ return getQuestionFromIdentifiers({ isCondition, inputValue });
94
+ };
95
+ const getPropositions = (n, { answer, isCondition, inputValue }) => {
96
+ const propositions = [];
97
+ const correct = parseInt(answer);
98
+ addValidProp(propositions, correct.frenchify());
99
+ if (isCondition) {
100
+ tryToAddWrongProp(propositions, (inputValue + 3).frenchify());
101
+ tryToAddWrongProp(propositions, (2 * inputValue).frenchify());
102
+ }
103
+ else {
104
+ tryToAddWrongProp(propositions, (inputValue + 5).frenchify());
105
+ tryToAddWrongProp(propositions, (2 * inputValue).frenchify());
106
+ tryToAddWrongProp(propositions, (inputValue ** 2).frenchify());
107
+ }
108
+ tryToAddWrongProp(propositions, (correct + 1).frenchify());
109
+ tryToAddWrongProp(propositions, (correct - 1).frenchify());
110
+ while (propositions.length < n) {
111
+ tryToAddWrongProp(propositions, randint(0, 25).frenchify());
112
+ }
113
+ return shuffleProps(propositions, n);
114
+ };
115
+ const isAnswerValid = (ans, { answer }) => {
116
+ return ans === answer;
117
+ };
118
+ export const pyIfElseCondition = {
119
+ id: "pyIfElseCondition",
120
+ label: "Conditions simples et doubles en Python",
121
+ isSingleStep: true,
122
+ generator: (nb) => getDistinctQuestions(getPyIfElseConditionQuestion, nb),
123
+ qcmTimer: 60,
124
+ freeTimer: 60,
125
+ getPropositions,
126
+ isAnswerValid,
127
+ getInstruction,
128
+ getHint,
129
+ getCorrection,
130
+ subject: "Mathématiques",
131
+ getQuestionFromIdentifiers,
132
+ hasHintAndCorrection: true,
133
+ };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ v: string | number;
4
+ vType: string;
5
+ };
6
+ export declare const variableType: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=variableType.d.ts.map
@@ -0,0 +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;AAuGF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAkB9C,CAAC"}
@@ -0,0 +1,118 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randint } from "../../../math/utils/random/randint.js";
4
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
5
+ const getPropositions = (n, { answer }) => {
6
+ const propositions = [];
7
+ addValidProp(propositions, answer, "raw");
8
+ tryToAddWrongProp(propositions, "Nombre entier", "raw");
9
+ tryToAddWrongProp(propositions, "Nombre flottant", "raw");
10
+ tryToAddWrongProp(propositions, "Chaine de caractères", "raw");
11
+ return shuffleProps(propositions, n);
12
+ };
13
+ const getAnswer = (identifiers) => {
14
+ const { v, vType } = identifiers;
15
+ if (vType === "int") {
16
+ return "Nombre entier";
17
+ }
18
+ else if (vType === "float") {
19
+ return "Nombre flottant";
20
+ }
21
+ else if (vType === "str") {
22
+ return "Chaine de caractères";
23
+ }
24
+ else {
25
+ throw new Error(`Unknown type: ${vType}`);
26
+ }
27
+ };
28
+ const getInstruction = (identifiers) => {
29
+ const { v, vType } = identifiers;
30
+ return `On exécute le script en Python ci-dessous :\n
31
+ \`\`\`python
32
+ v = ${vType === "str" ? `"${v}"` : v}
33
+ \`\`\`
34
+ \n
35
+ Quel est le type de la variable var ?
36
+ `;
37
+ };
38
+ const getHint = (identifiers) => {
39
+ 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
+ const getCorrection = (identifiers) => {
42
+ const { v, vType } = identifiers;
43
+ let explanationType = "";
44
+ if (vType === "int") {
45
+ explanationType = "Nombre entier";
46
+ }
47
+ else if (vType === "float") {
48
+ explanationType = "Nombre flottant";
49
+ }
50
+ else if (vType === "str") {
51
+ explanationType = "Chaine de caractères";
52
+ }
53
+ 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
+ Ici, la variable \`v\` est de type ${explanationType.toLocaleLowerCase()}.`;
56
+ };
57
+ const getKeys = (identifiers) => {
58
+ return [];
59
+ };
60
+ const isAnswerValid = (ans, { answer }) => {
61
+ try {
62
+ throw Error("VEA not implemented");
63
+ }
64
+ catch (err) {
65
+ return handleVEAError(err);
66
+ }
67
+ };
68
+ const getVariableTypeQuestion = (ops) => {
69
+ const vTypes = ["int", "float", "str"];
70
+ const vType = vTypes[randint(0, vTypes.length)];
71
+ let v;
72
+ if (vType === "int") {
73
+ v = randint(0, 100);
74
+ }
75
+ else if (vType === "float") {
76
+ v = randint(0, 100) + Math.random().toFixed(2);
77
+ }
78
+ else {
79
+ const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
80
+ const length = randint(3, 8);
81
+ let result = "";
82
+ for (let i = 0; i < length; i++) {
83
+ result += chars.charAt(randint(0, chars.length));
84
+ }
85
+ v = result;
86
+ }
87
+ const identifiers = { v, vType };
88
+ return getQuestionFromIdentifiers(identifiers);
89
+ };
90
+ const getQuestionFromIdentifiers = (identifiers) => {
91
+ return {
92
+ answer: getAnswer(identifiers),
93
+ instruction: getInstruction(identifiers),
94
+ keys: getKeys(identifiers),
95
+ answerFormat: "raw",
96
+ identifiers,
97
+ hint: getHint(identifiers),
98
+ correction: getCorrection(identifiers),
99
+ };
100
+ };
101
+ export const variableType = {
102
+ id: "variableType",
103
+ label: "Déterminer le type d’une variable en Python",
104
+ isSingleStep: true,
105
+ generator: (nb, opts) => getDistinctQuestions(() => getVariableTypeQuestion(opts), nb),
106
+ qcmTimer: 60,
107
+ freeTimer: 60,
108
+ getPropositions,
109
+ isAnswerValid,
110
+ subject: "Mathématiques",
111
+ getInstruction,
112
+ getHint,
113
+ getCorrection,
114
+ getAnswer,
115
+ getQuestionFromIdentifiers,
116
+ hasHintAndCorrection: true,
117
+ answerType: "QCU",
118
+ };
@@ -17,7 +17,7 @@ const getAnswer = (identifiers) => {
17
17
  const getInstruction = (identifiers) => {
18
18
  const { a, initialValue, iterations, opIndex, step, x } = identifiers;
19
19
  const op = operations[opIndex];
20
- return `Qu'affichera le programme suivant ?
20
+ return `Qu'affichera le programme suivant \`var\` ?
21
21
  \`\`\`
22
22
  a = ${a}
23
23
  n = ${initialValue}
@@ -1 +1 @@
1
- {"version":3,"file":"arithmeticExplicitFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA2FF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAchE,CAAC"}
1
+ {"version":3,"file":"arithmeticExplicitFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA4FF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAchE,CAAC"}
@@ -71,6 +71,7 @@ const getPropositions = (n, { answer, firstValue, askedRank, reason }) => {
71
71
  const isAnswerValid = (ans, { answer, askedRank }) => {
72
72
  return [
73
73
  answer,
74
+ `u${askedRank}=${answer}`,
74
75
  `u_${askedRank}=${answer}`,
75
76
  `u_{${askedRank}}=${answer}`,
76
77
  ].includes(ans);
@@ -1 +1 @@
1
- {"version":3,"file":"arithmeticFindReason.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticFindReason.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA0EF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAiBtD,CAAC"}
1
+ {"version":3,"file":"arithmeticFindReason.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticFindReason.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA0EF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAiBtD,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
3
4
  import { randint } from "../../../../math/utils/random/randint.js";
4
5
  import { substract } from "../../../../tree/nodes/operators/substractNode.js";
5
6
  import { shuffle } from "../../../../utils/alea/shuffle.js";
@@ -63,7 +64,7 @@ const getPropositions = (n, { answer }) => {
63
64
  return shuffle(propositions);
64
65
  };
65
66
  const isAnswerValid = (ans, { answer }) => {
66
- return ans === answer;
67
+ return numberVEA(ans, answer);
67
68
  };
68
69
  export const arithmeticFindReason = {
69
70
  id: "arithmeticFindReason",
@@ -1 +1 @@
1
- {"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAK/C,KAAK,WAAW,GAAG;IAIjB,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C,CAAC;AA6GF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
1
+ {"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAK/C,KAAK,WAAW,GAAG;IAIjB,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C,CAAC;AAwIF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}