Données & Types Bac 2026

Séance 1 : Structures de données

Objectifs : Scalaires (Div, Mod, Racine, Aléa), chaînes (Pos, Sous_chaine, Base 0) et T.D.O.
P{{ currentProblem }} • Phase {{ currentPhase === 'all' ? 'Toutes' : currentPhase + ' / ' + currentPhasesList.length }}
{{ currentProblemSubtitle }}
{{ currentPhaseTitle }}
Étape 1

Situation & Labo 2D : Distance euclidienne

10 min
Énoncé
« Calculer la distance entre l'origine du plan cartésien O(0,0) et un point P(X, Y) aléatoire dans X ∈ [-10, 10] et Y ∈ [-10, 10], puis déterminer si son arrondi est pair. »
Décomposition :
  • 1
    Aléatoire : x, y ∈ [-10, 10].
  • 2
    Distance : \(d = \sqrt{x^2 + y^2}\).
  • 3
    Arrondi : d_arrondi ← Arrondi(d).
  • 4
    Parité : d_arrondi Mod 2 = 0.
Formule mathématique
$$d = \sqrt{x^2 + y^2}$$
est_pair ⇔ (Arrondi(d) Mod 2 = 0)
Labo 2D [-10, 10]
O(0,0) P({{ simPoint.x }}, {{ simPoint.y }})
Distance
{{ simDistance.toFixed(3) }}
Arrondi
{{ simRounded }}
Parité
{{ simIsEven ? 'PAIR' : 'IMPAIR' }}
Questions orales :
{{ q.question }}
Algo :
{{ q.algoAns }}
Python :
{{ q.pyAns }}
Étape 2

Fonctions numériques prédéfinies

15 min
Notion Algorithme Python
Types numériques Entier, Réel, Booléen int, float, bool
Division réelle /  (ex: 14 / 3 → 4.666...) /  (type float)
Quotient entier div  (ex: 14 div 3 → 4) //  (ex: 14 // 3 → 4)
Reste entier mod  (ex: 14 mod 3 → 2) %  (ex: 14 % 3 → 2)
Racine carrée Racine(x) sqrt(x)  (module math)
Arrondi Arrondi(x) round(x)
Partie entière Ent(x) int(x)
Valeur absolue Abs(x) abs(x)
Aléatoire Aléa(vi, vf) randint(vi, vf)  (module random)
À retenir :
  • div et Ent(x) produisent un Entier ; / produit un Réel.
  • En Python, importer sqrt (math) et randint (random).
Étape 3

Bilan & Quiz : Types numériques

5 min
Questions flash :
{{ f.expr }} {{ f.type }}
Algo : {{ f.resAlgo }}
Python : {{ f.resPy }}
Cliquer pour voir...

Quiz : Scalaires & Arithmétique
{{ quizP1Count }} questions
Score : {{ quizP1Score }} / {{ quizP1Count }}
{{ qIdx + 1 }} {{ q.question }}
Explication : {{ q.explanation }}
Fin du Problème 1
Étape 1

Situation & Labo Chaîne : Code d'inscription

10 min
Énoncé
« À partir d'un code (ex: "info-2026"), vérifier que le suffixe est numérique, passer le préfixe en majuscules ("INFO") et incrémenter l'année pour produire "INFO-2027". »
Décomposition :
  • 1
    Séparateur : Position de "-" via Pos / .find().
  • 2
    Découpage : Tranches via Sous_chaine / slicing [d:f] (f exclue).
  • 3
    Validation & Calcul : Estnum, conversion Valeur et + 1.
  • 4
    Recomposition : Majus, Convch et concaténation +.
Exemple
"info-2026" "INFO-2027"
• Séparateur : "-" (indice 4)
• Préfixe : "info" → "INFO"
• Suffixe : "2026" → 2027
Labo Chaîne Analyseur indicé de chaînes (Base 0)
Indiçage (Base 0) : Longueur : {{ cleanInput.length }}
{{ c.char }} {{ c.index }}
Saisir une chaîne.
Séparateur '-'
{{ hasSep ? 'Indice ' + sepIndex : 'Absent (-1)' }}
Préfixe
"{{ prefixeExtrait }}"
Suffixe (Estnum)
"{{ suffixeExtrait }}" {{ isSuffixNumeric ? 'Numérique' : 'Non numérique' }}
Nouveau code
{{ nouveauCode }}
Questions orales :
{{ q.question }}
Algo :
{{ q.algoAns }}
Python :
{{ q.pyAns }}
Étape 2

Fonctions prédéfinies sur les chaînes

15 min
Primitive Algorithme Python
Indiçage (1er car.) Ch[0]  (0 ≤ i < Long(Ch)) ch[0]  (Base 0)
Longueur Long(ch) len(ch)
Position Pos(ch1, ch2)  (-1 si absent) ch2.find(ch1)  (-1 si absent)
Sous-chaîne Sous_chaine(ch, d, f)  (f exclue) ch[d:f]  (f exclu)
Suppression Effacer(ch, d, f)  (f exclue) ch[:d] + ch[f:]
Majuscules Majus(ch) ch.upper()
Test numérique Estnum(ch) ch.isdecimal()
Vers nombre Valeur(ch) int(ch) / float(ch)
Vers chaîne Convch(x) str(x)
ASCII / Caractère Ord(c)  |  Chr(d) ord(c)  |  chr(d)
À retenir :
  • Base 0 : Premier caractère en Ch[0].
  • Fin exclue : Dans Sous_chaine(ch, d, f) et ch[d:f], f est exclue (longueur = f - d).
  • Absence : Pos et .find() renvoient -1.
Étape 3

Bilan & Quiz : Chaînes de caractères

5 min
Questions flash :
{{ f.expr }} {{ f.type }}
Algo : {{ f.resAlgo }}
Python : {{ f.resPy }}
Cliquer pour voir...

Quiz : Chaînes & Caractères
{{ quizP2Count }} questions
Score : {{ quizP2Score }} / {{ quizP2Count }}
{{ qIdx + 1 }} {{ q.question }}
Explication : {{ q.explanation }}
Séance 1 terminée !
Problème {{ currentProblem }} / 2 Phase {{ currentPhase }} / {{ currentPhasesList.length }} {{ currentPhasesList[currentPhase - 1].shortTitle }}
Séance 2