mirror of
https://github.com/deunix-educ/PyQuest.git
synced 2026-11-25 08:19:44 +01:00
Add first three levels, manifest and level format conventions
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
id: 00-intro
|
||||
title:
|
||||
fr: Qu'est-ce qu'un programme ?
|
||||
en: What is a program?
|
||||
difficulty: 0
|
||||
xp: 10
|
||||
requires: []
|
||||
steps:
|
||||
- type: explain
|
||||
voice: true
|
||||
text:
|
||||
fr: Un programme est une liste d'instructions. L'ordinateur les lit une par une, de haut en bas.
|
||||
en: A program is a list of instructions. The computer reads them one by one, from top to bottom.
|
||||
- type: explain
|
||||
voice: true
|
||||
text:
|
||||
fr: "Comme une recette : 1. Casser les œufs. 2. Battre les œufs. 3. Cuire l'omelette. Si tu changes l'ordre, le résultat change."
|
||||
en: "Like a recipe: 1. Crack the eggs. 2. Beat the eggs. 3. Cook the omelette. Change the order and the result changes."
|
||||
- type: explain
|
||||
voice: true
|
||||
text:
|
||||
fr: L'ordinateur ne devine rien. Il fait exactement ce que tu écris, rien de plus. C'est pour ça qu'on doit être précis.
|
||||
en: The computer guesses nothing. It does exactly what you write, nothing more. That is why we must be precise.
|
||||
- type: explain
|
||||
voice: true
|
||||
text:
|
||||
fr: "Python est un langage pour écrire ces instructions. Dans le prochain niveau, tu écris ta première ligne."
|
||||
en: "Python is a language for writing these instructions. In the next level, you write your first line."
|
||||
mission:
|
||||
title:
|
||||
fr: Je comprends
|
||||
en: I understand
|
||||
goal:
|
||||
fr: Clique sur « Je comprends » quand tu es prêt·e à écrire ton premier programme.
|
||||
en: Click "I understand" when you are ready to write your first program.
|
||||
reward_sound: level_unlocked
|
||||
@@ -0,0 +1,87 @@
|
||||
id: 01-hello
|
||||
title:
|
||||
fr: Ton premier programme
|
||||
en: Your first program
|
||||
difficulty: 0
|
||||
xp: 20
|
||||
requires:
|
||||
- 00-intro
|
||||
steps:
|
||||
- type: explain
|
||||
voice: true
|
||||
text:
|
||||
fr: "`print()` affiche du texte à l'écran. Le texte va entre guillemets, dans les parenthèses."
|
||||
en: "`print()` shows text on the screen. The text goes between quotes, inside the parentheses."
|
||||
- type: code
|
||||
starter: |
|
||||
# Ceci est un commentaire : Python l'ignore.
|
||||
print("Bonjour")
|
||||
instruction:
|
||||
fr: Clique sur « Exécuter » pour voir ce que fait ce code.
|
||||
en: Click "Run" to see what this code does.
|
||||
tests:
|
||||
- kind: no_syntax_error
|
||||
- kind: stdout_equals
|
||||
value: "Bonjour\n"
|
||||
solution: |
|
||||
print("Bonjour")
|
||||
- type: code
|
||||
starter: |
|
||||
print("Bonjour")
|
||||
instruction:
|
||||
fr: Change le texte pour afficher exactement « Bonjour le monde ».
|
||||
en: Change the text to show exactly "Hello world".
|
||||
tests:
|
||||
- kind: stdout_equals
|
||||
value: "Bonjour le monde\n"
|
||||
message:
|
||||
fr: Vérifie les majuscules et les espaces.
|
||||
en: Check the capital letters and the spaces.
|
||||
hints:
|
||||
fr:
|
||||
- Ne change que ce qui est entre les guillemets.
|
||||
- Écris Bonjour le monde avec une majuscule à Bonjour seulement.
|
||||
en:
|
||||
- Only change what is between the quotes.
|
||||
- Write Hello world with a capital H only.
|
||||
solution: |
|
||||
print("Bonjour le monde")
|
||||
- type: explain
|
||||
voice: true
|
||||
text:
|
||||
fr: "Un texte entre guillemets s'appelle une chaîne de caractères. Chaque `print()` écrit sur une nouvelle ligne."
|
||||
en: "Text between quotes is called a string. Each `print()` writes on a new line."
|
||||
- type: code
|
||||
starter: |
|
||||
print("Première ligne")
|
||||
instruction:
|
||||
fr: Ajoute un deuxième print() pour afficher « Deuxième ligne » sous la première.
|
||||
en: Add a second print() to show "Deuxième ligne" below the first one.
|
||||
tests:
|
||||
- kind: stdout_equals
|
||||
value: "Première ligne\nDeuxième ligne\n"
|
||||
hints:
|
||||
fr:
|
||||
- Écris un nouveau print() sur la ligne suivante.
|
||||
en:
|
||||
- Write a new print() on the next line.
|
||||
solution: |
|
||||
print("Première ligne")
|
||||
print("Deuxième ligne")
|
||||
mission:
|
||||
title:
|
||||
fr: Carte de visite
|
||||
en: Business card
|
||||
goal:
|
||||
fr: Avec trois print(), affiche ton prénom, ta ville et un loisir, un par ligne.
|
||||
en: With three print() calls, show your first name, your city and a hobby, one per line.
|
||||
starter: |
|
||||
# Écris tes trois print() ci-dessous
|
||||
tests:
|
||||
- kind: no_syntax_error
|
||||
- kind: stdout_matches_regex
|
||||
value: "^[^\\n]+\\n[^\\n]+\\n[^\\n]+\\n?$"
|
||||
message:
|
||||
fr: Il faut exactement trois lignes affichées, non vides.
|
||||
en: Exactly three non-empty lines must be shown.
|
||||
reward_sound: success_small
|
||||
@@ -0,0 +1,136 @@
|
||||
id: 02-variables
|
||||
title:
|
||||
fr: Variables et types
|
||||
en: Variables and types
|
||||
difficulty: 1
|
||||
xp: 30
|
||||
requires:
|
||||
- 01-hello
|
||||
steps:
|
||||
- type: explain
|
||||
voice: true
|
||||
text:
|
||||
fr: "Une variable est une boîte avec un nom. Tu y ranges une valeur : `age = 12`. Le signe `=` range la valeur dans la boîte."
|
||||
en: "A variable is a box with a name. You put a value in it: `age = 12`. The `=` sign stores the value in the box."
|
||||
- type: code
|
||||
starter: |
|
||||
name = "Alice"
|
||||
print(name)
|
||||
instruction:
|
||||
fr: Exécute le code, puis remplace "Alice" par ton prénom.
|
||||
en: Run the code, then replace "Alice" with your first name.
|
||||
tests:
|
||||
- kind: var_type_is
|
||||
name: name
|
||||
value: str
|
||||
- kind: stdout_matches_regex
|
||||
value: "^[^\\n]+\\n$"
|
||||
solution: |
|
||||
name = "Alice"
|
||||
print(name)
|
||||
- type: explain
|
||||
voice: true
|
||||
text:
|
||||
fr: "Il existe plusieurs types. `str` : du texte (\"chat\"). `int` : un nombre entier (7). `float` : un nombre à virgule (3.14, avec un point)."
|
||||
en: "There are several types. `str`: text (\"cat\"). `int`: a whole number (7). `float`: a decimal number (3.14, with a dot)."
|
||||
- type: code
|
||||
starter: |
|
||||
age = 10
|
||||
print(age)
|
||||
instruction:
|
||||
fr: Change la variable age pour qu'elle vaille 12.
|
||||
en: Change the variable age so that it equals 12.
|
||||
tests:
|
||||
- kind: var_equals
|
||||
name: age
|
||||
value: 12
|
||||
- kind: var_type_is
|
||||
name: age
|
||||
value: int
|
||||
hints:
|
||||
fr:
|
||||
- Ne change que le nombre à droite du signe égal.
|
||||
en:
|
||||
- Only change the number on the right of the equals sign.
|
||||
solution: |
|
||||
age = 12
|
||||
print(age)
|
||||
- type: code
|
||||
starter: |
|
||||
price = 2
|
||||
print(price)
|
||||
instruction:
|
||||
fr: Fais de price un nombre à virgule qui vaut 2.5.
|
||||
en: Make price a decimal number equal to 2.5.
|
||||
tests:
|
||||
- kind: var_equals
|
||||
name: price
|
||||
value: 2.5
|
||||
- kind: var_type_is
|
||||
name: price
|
||||
value: float
|
||||
hints:
|
||||
fr:
|
||||
- Écris 2.5 avec un point, pas une virgule.
|
||||
en:
|
||||
- Write 2.5 with a dot, not a comma.
|
||||
solution: |
|
||||
price = 2.5
|
||||
print(price)
|
||||
- type: explain
|
||||
voice: true
|
||||
text:
|
||||
fr: "Tu peux calculer avec des variables : `total = price * 3`. Une variable peut aussi être réaffectée plus tard."
|
||||
en: "You can calculate with variables: `total = price * 3`. A variable can also be reassigned later."
|
||||
- type: code
|
||||
starter: |
|
||||
price = 2.5
|
||||
quantity = 4
|
||||
instruction:
|
||||
fr: Crée une variable total qui vaut price multiplié par quantity, puis affiche-la.
|
||||
en: Create a variable total equal to price multiplied by quantity, then print it.
|
||||
tests:
|
||||
- kind: var_equals
|
||||
name: total
|
||||
value: 10.0
|
||||
- kind: stdout_equals
|
||||
value: "10.0\n"
|
||||
hints:
|
||||
fr:
|
||||
- "Le signe de la multiplication est `*`."
|
||||
- "Écris `total = price * quantity` puis `print(total)`."
|
||||
en:
|
||||
- "The multiplication sign is `*`."
|
||||
- "Write `total = price * quantity` then `print(total)`."
|
||||
solution: |
|
||||
price = 2.5
|
||||
quantity = 4
|
||||
total = price * quantity
|
||||
print(total)
|
||||
mission:
|
||||
title:
|
||||
fr: Calculatrice de pourboire
|
||||
en: Tip calculator
|
||||
goal:
|
||||
fr: "L'addition est de 50 et le pourboire de 15 % (0.15). Calcule le pourboire dans `tip`, le total dans `total`, puis affiche le total."
|
||||
en: "The bill is 50 and the tip is 15% (0.15). Compute the tip in `tip`, the total in `total`, then print the total."
|
||||
starter: |
|
||||
bill = 50
|
||||
rate = 0.15
|
||||
# Calcule tip et total ci-dessous
|
||||
tests:
|
||||
- kind: var_equals
|
||||
name: tip
|
||||
value: 7.5
|
||||
message:
|
||||
fr: "tip doit valoir bill * rate."
|
||||
en: "tip must equal bill * rate."
|
||||
- kind: var_equals
|
||||
name: total
|
||||
value: 57.5
|
||||
message:
|
||||
fr: "total doit valoir bill + tip."
|
||||
en: "total must equal bill + tip."
|
||||
- kind: stdout_equals
|
||||
value: "57.5\n"
|
||||
reward_sound: success_small
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"version": 1,
|
||||
"levels": [
|
||||
{ "id": "00-intro", "requires": [] },
|
||||
{ "id": "01-hello", "requires": ["00-intro"] },
|
||||
{ "id": "02-variables", "requires": ["01-hello"] }
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user