diff --git a/fr-FR/code/complete/main.py b/fr-FR/code/complete/main.py index 407f373..7a2dc12 100644 --- a/fr-FR/code/complete/main.py +++ b/fr-FR/code/complete/main.py @@ -20,6 +20,6 @@ def roule_de(): print(f'{111111111 * 111111111}') print(f'La date et l\'heure sont {datetime.now()}') roule_de() # Appel la fonction lancer de dés -print(f'J\'❤️ ...') +print(f"J'❤️ ...") print(f'... me rend 😃') print(f'Je voudrais faire ... avec {python}') diff --git a/fr-FR/code/starter/main.py b/fr-FR/code/starter/main.py index 4ae3768..159f9d3 100644 --- a/fr-FR/code/starter/main.py +++ b/fr-FR/code/starter/main.py @@ -1,11 +1,11 @@ -# importations +# imports # variables -monde = '🌍🌎🌏' +world = '🌍🌎🌏' python = 'Python 🐍' -feu = '🔥' +fire = '🔥' -# Définitions de fonctions +# Function definitions -# Mettre le code à exécuter ci-dessous +# Put code to run under here diff --git a/fr-FR/images/run_hello_world.png b/fr-FR/images/run_hello_world.png index 653543c..f08c165 100644 Binary files a/fr-FR/images/run_hello_world.png and b/fr-FR/images/run_hello_world.png differ diff --git a/fr-FR/landing.md b/fr-FR/landing.md new file mode 100644 index 0000000..0eba53c --- /dev/null +++ b/fr-FR/landing.md @@ -0,0 +1,7 @@ +## What you will make + +Write an interactive program in Python that uses emojis 🙌 🙌🏼 🙌🏽 🙌🏾 🙌🏿. + +Click on the **Run** button. + + diff --git a/fr-FR/meta.yml b/fr-FR/meta.yml index 6061d6b..10e46e8 100644 --- a/fr-FR/meta.yml +++ b/fr-FR/meta.yml @@ -1,40 +1,49 @@ ---- title: "Editeur Bonjour \U0001F30D\U0001F30E\U0001F30F" hero_image: images/banner.png description: Écris un projet Python interactif qui utilise des emojis meta_title: Projets de codage Python pour enfants et adolescent·e·s | Bonjour le monde meta_description: Apprends Python avec la Raspberry Pi Foundation. Crée un projet de codage Python interactif qui utilise des emojis. version: 4 -listed: false +listed: true copyedit: false last_tested: "2021-10-06" +landing: true steps: - - title: step 1 - - title: step 2 + - + title: Print Hello + - + title: Variables completion: - engaged - - title: step 3 - - title: step 4 - - title: step 5 - - title: step 6 - - title: step 7 - - title: step 8 - - title: step 9 - - title: step 10 - - title: step 11 - - title: step 12 - - title: step 13 - - title: step 14 - - title: step 15 - - title: step 16 + - + title: Imprimer des variables + - + title: Imprimer une autre variable + - + title: Opérateurs + - + title: Créer un calcul + - + title: Utilisation des modules + - + title: Imprimer la date + - + title: Fonctions + - + title: Lancer un dé + - + title: Importer randint + - + title: Nombres aléatoires + - + title: Multiplier les chaînes + - + title: Obtenir une entrée + - + title: Changer le dé completion: - internal - - title: step 17 - knowledge_quiz: - path: quiz1 - version: 1 - questions: 3 - passing_score: 3 - - title: step 18 + - + title: À toi de jouer completion: - external diff --git a/fr-FR/step_1.md b/fr-FR/step_1.md index 2693a8a..b9e251d 100644 --- a/fr-FR/step_1.md +++ b/fr-FR/step_1.md @@ -1,54 +1,33 @@ -

Print Bonjour

+## Print Hello ---- task --- +➡️ Display the word 'Hello' on the screen. -➡️ Afficher le mot 'Bonjour' sur l'écran +In Python, `print()` outputs strings (words or numbers) to the screen. ---- /task --- +Type the code to `print()` Hello to the screen: -En Python, `print()` affiche des chaînes (mots ou nombres) à l'écran. +```python line_numbers="true" line_number_start="10" line_highlights="11" -Tape le code pour `print()` (imprimer) Bonjour à l'écran : +# Put code to run under here. +print(f'Hello') -
- ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 11 ---- - -# Mettre le code à exécuter ci-dessous. -print(f'Bonjour ') - ---- /code --- +``` -
+## Now run your code -**Test :** clique sur le bouton **Exécuter**. -Tu devrais voir ceci lorsque tu exécutes ton code . +This is what you should see when you run your code. -
``` Bonjour ``` -
- -
- -### Astuce - -Lorsque tu tapes une parenthèse ouvrante `(` , le Code Editor ajoutera automatiquement une parenthèse fermante `)` -Cela se produit également lorsque tu tapes une apostrophe ouvrante `'`. - -
- -
-### Déboguer +> [!TIP] +> +> When you type an opening bracket `(` the code editor will automatically add a closing bracket `)`. +> This also happens when you type an opening apostrophe `'`. -Si tu obtiens une erreur, vérifie ton code très attentivement. Vérifie qu'il y a des guillemets simples autour de `Bonjour` afin que Python sache qu'il s'agit de texte. +> [!DEBUG] +> +> If you get an error then check your code really carefully. Check there are single quotes around `Hello` so Python knows it is meant to be text. -
+Click the **Run** button and check that `Hello` appears in the output. diff --git a/fr-FR/step_10.md b/fr-FR/step_10.md index b2ab81f..f6a57b4 100644 --- a/fr-FR/step_10.md +++ b/fr-FR/step_10.md @@ -1,71 +1,46 @@ -

Lancer un dé

- ---- task --- +## Roll dice ➡️ Créer une fonction pour simuler le lancement d'un dé. -➡️ Appeler la fonction pour exécuter le code qu'elle contient. - ---- /task --- - -Crée une fonction appelée `roule_de()`, qui imprime le nombre 4. +Create a function called `roll_dice()` that prints out the number 4. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 9 -line_highlights: 10, 11 ---- +```python line_numbers="true" line_number_start="9" line_highlights="10,11" -# Définitions de fonctions -def roule_de(): - print(f'Tu as obtenu un {4}') +# Function definitions +def roll_dice(): + print(f'You rolled a {4}') + +# Put code to run under here -# Mettre le code à exécuter ci-dessous +``` ---- /code --- +Then, call the function at the bottom of your code. -Ensuite, appelle la fonction en bas de ton code. +```python line_numbers="true" line_number_start="18" line_highlights="19" +print(f'The date and time is {datetime.now()}') +roll_dice() ---- code --- ---- -language: python -line_numbers: true -line_number_start: 18 -line_highlights: 19 ---- -print(f'La date et l'heure sont {datetime.now()}') -roule_de() +``` ---- /code --- +## Now run your code -**Test :** clique sur le bouton **Exécuter**. -Tu devrais voir ceci lorsque tu exécutes ton code. +This is what you should see when you run your code. -
``` -Bonjour 🌍🌎🌏 -Bienvenue sur Python 🐍 -Python 🐍 est bon en maths ! +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! 12345678987654321 -La date et l'heure sont 2023-11-21 15:55:33.038000 -Tu as obtenu un 4 +The date and time is 2023-11-21 15:55:33.038000 +You rolled a 4 ``` -
- -
- -### Astuce - -Tu peux utiliser la touche **Tab** de ton clavier pour insérer 4 espaces. Appuyer sur **Maj** et **Tab** supprimera les 4 espaces. - -
- -
-### Déboguer +> [!TIP] +> +> You can use the **Tab** key on your keyboard to insert 4 spaces. Pressing **Shift** and **Tab** will remove the 4 spaces. -Vérifie que tu as des parenthèses `()` et deux points `:` à la fin de ta définition de fonction. Vérifie également que tu utilises des parenthèses `()` lorsque tu appelles ta fonction. +> [!DEBUG] +> +> Check that you have brackets `()` and a colon `:` at the end of your function definition. Also check you are using brackets `()` when you call your function. -
+Click the **Run** button and check that the last line says `You rolled a 4`. diff --git a/fr-FR/step_11.md b/fr-FR/step_11.md index 61965ae..b0f2601 100644 --- a/fr-FR/step_11.md +++ b/fr-FR/step_11.md @@ -1,26 +1,19 @@ -

Importer randint

- ---- task --- +## Import randint ➡️ Importer la fonction `randint` depuis le module `random`. ---- /task --- - -Un autre module appelé `random` peut être utilisé pour créer des nombres aléatoires +Another module called `random` can be used to create random numbers. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 1 -line_highlights: 3 ---- +```python line_numbers="true" line_number_start="1" line_highlights="3" -# importations +# imports from datetime import datetime from random import randint ---- /code --- +``` + +Your code output will not change when you run it. -Le résultat de ton code restera identique à chaque exécution. +## Now run your code +Run your code and check that the output stays the same as in the previous step after importing `randint`. diff --git a/fr-FR/step_12.md b/fr-FR/step_12.md index f44c059..92a937f 100644 --- a/fr-FR/step_12.md +++ b/fr-FR/step_12.md @@ -1,53 +1,36 @@ -

Nombres aléatoires

- ---- task --- +## Random numbers ➡️ Choisir un nombre aléatoire pour le lancer de dés. ---- /task --- - Utilise la fonction `randint` que tu as importée pour choisir un nombre aléatoire entre 1 et 6 pour le lancer de dés. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 12 ---- +```python line_numbers="true" line_number_start="10" line_highlights="12" -# Définitions de fonctions -def roule_de(): - print(f'Tu as obtenu un {randint(1, 6)}') +# Function definitions +def roll_dice(): + print(f'You rolled a {randint(1, 6)}') + +``` ---- /code --- +## Now run your code -**Test :** clique sur le bouton **Exécuter**. -Maintenant, lorsque tu exécutes ton code, un nouveau nombre aléatoire entre 1 et 6 sera choisi à chaque fois. +Now when you run your code, a new random number between 1 and 6 will be chosen each time. -
``` -Bonjour 🌍🌎🌏 -Bienvenue sur Python 🐍 -Python 🐍 est bon en maths ! +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! 12345678987654321 -La date et l'heure sont 2023-11-21 16:02:12.535000 -Tu as obtenu un 6 +The date and time is 2023-11-21 16:02:12.535000 +You rolled a 6 ``` -
- -
- -### Astuce - -`randint` est l'abréviation d'entier aléatoire. Les entiers sont des nombres entiers. - -
- -
-### Déboguer +> [!TIP] +> +> `randint` is short for random integer. Integers are whole numbers. -Vérifie tes parenthèses et accolades si tu obtiens une erreur. Note que le même nombre peut être choisi plusieurs fois. C'est aléatoire ! +> [!DEBUG] +> +> Check your brackets and curly brackets if you get an error. Take note that the same number might be chosen over and over again. It's random! -
+Click the **Run** button and check that the last line says `You rolled a` followed by a number from 1 to 6. diff --git a/fr-FR/step_13.md b/fr-FR/step_13.md index 432b396..999bb68 100644 --- a/fr-FR/step_13.md +++ b/fr-FR/step_13.md @@ -1,65 +1,45 @@ -

Multiplier les chaînes

+## Multiply strings ---- task --- - -➡️ Stocker le nombre aléatoire dans une variable. ➡️ Multiplier le nombre par l'emoji 🔥 pour imprimer l'emoji un nombre de fois égal au lancer de dés. ---- /task --- - En Python, tu peux multiplier des chaînes de caractères telles que des emojis ou des mots entiers par un nombre, afin qu'elles s'impriment plusieurs fois. Stocke le nombre aléatoire dans une variable appelée `roule`. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 12 ---- +```python line_numbers="true" line_number_start="10" line_highlights="12" -# Définitions de fonctions -def roule_de(): - roule = randint(1,6) +# Function definitions +def roll_dice(): + roll = randint(1,6) ---- /code --- +``` -Multiplie le nombre aléatoire stocké dans `roule` par l'emoji 🔥 et imprime le résultat. +Multiply the random number stored in `roll` by the 🔥 emoji, and print the result. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 13 ---- +```python line_numbers="true" line_number_start="10" line_highlights="13" -# Définitions de fonctions -def roule_de(): - roule = randint(1,6) - print(f'Tu as obtenu un {roule} {feu * roule}') +# Function definitions +def roll_dice(): + roll = randint(1,6) + print(f'You rolled a {roll} {fire * roll}') + +``` ---- /code --- +## Now run your code -**Test :** clique sur le bouton **Exécuter**. -Ton code de sortie devrait ressembler à ceci : +Your output code should look something like this: -
``` -Bonjour 🌍🌎🌏 -Bienvenue sur Python 🐍 -Python 🐍 est bon en maths ! +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! 12345678987654321 -La date et l'heure sont 2023-11-21 16:14:45.140000 -Tu as obtenu un 4 🔥🔥🔥🔥 +The date and time is 2023-11-21 16:14:45.140000 +You rolled a 4 🔥🔥🔥🔥 ``` -
- -
- -### Déboguer -Vérifie que toutes tes parenthèses sont identiques à celles de l’exemple de code ci-dessus. +> [!DEBUG] +> +> Check all your brackets are the same as the code example above. -
+Click the **Run** button and check that the last line shows the dice number and the same number of fire emojis. diff --git a/fr-FR/step_14.md b/fr-FR/step_14.md index 0fdbb76..63b3854 100644 --- a/fr-FR/step_14.md +++ b/fr-FR/step_14.md @@ -1,44 +1,35 @@ -

Obtenir une entrée

- ---- task --- +## Get input ➡️ Permettre à la personne qui utilise ton programme de saisir des données. ---- /task --- - Tu peux utiliser `input()` pour demander à la personne utilisant ton programme de saisir du texte et de l'enregistrer en tant que variable. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 12-13 ---- +```python line_numbers="true" line_number_start="10" line_highlights="12-13" -# Définitions de fonctions -def roule_de(): - max = input('Combien de faces y a-t-il sur ton dé ?') - print(f'C\'est un D {max}') - roule = randint(1,6) - print(f'Tu as obtenu un {roule} {feu * roule}') +# Function definitions +def roll_dice(): + max = input('How many sides on your dice?:') + print(f'That is a D {max}') + roll = randint(1,6) + print(f'You rolled a {roll} {fire * roll}') ---- /code --- +``` -**Test :** clique sur le bouton **Exécuter**. -Assure-toi d'appuyer sur la touche Entrée après avoir saisi le nombre de faces. -Tu devrais voir ceci lorsque tu exécutes ton code. +## Now run your code + +Ensure you press the Enter key after inputting how many sides. +This is what you should see when you run your code. -
``` -Bonjour 🌍🌎🌏 -Bienvenue sur Python 🐍 -Python 🐍 est bon en maths ! +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! 12345678987654321 -La date et l'heure sont 2023-11-21 16:20:41.323000 -Combien de faces y a-t-il sur ton dé ? +The date and time is 2023-11-21 16:20:41.323000 +How many sides on your dice?: 20 -C'est un D 20 -Tu as obtenu un 1 🔥 +That is a D 20 +You rolled a 1 🔥 ``` -
+ +Click the **Run** button, type a number such as `20`, and check that the program says `That is a D 20` before showing a dice roll. diff --git a/fr-FR/step_15.md b/fr-FR/step_15.md index 11a9071..0bf23e4 100644 --- a/fr-FR/step_15.md +++ b/fr-FR/step_15.md @@ -1,53 +1,39 @@ -

Changer le dé

+## Change the dice ---- task --- - -➡️ Modifier les données d’entrée en un entier. ➡️ Génèrer un nombre aléatoire compris entre 1 et le nombre de faces saisi par l'utilisateur. ---- /task --- - Les entrées sont toujours stockées sous forme de texte, mais nous devons utiliser l'entrée stockée dans `max` pour spécifier le plus grand nombre qui pourrait être obtenu. `max` est une chaîne, elle doit donc être changée en un entier `int()`. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 14 ---- +```python line_numbers="true" line_number_start="10" line_highlights="14" -# Définitions de fonctions -def roule_de(): - max = input('Combien de faces y a-t-il sur ton dé ?') - print(f'C\'est un D {max}') - roule = randint(1, int(max)) - print(f'Tu as obtenu un {roule} {feu * roule}') +# Function definitions +def roll_dice(): + max = input('How many sides on your dice?:') + print(f'That is a D {max}') + roll = randint(1, int(max)) + print(f'You rolled a {roll} {fire * roll}') + +``` ---- /code --- +## Now run your code -**Test :** clique sur le bouton **Exécuter**. -Voici ce que tu devrais voir : +This is what you should see: -
``` -Bonjour 🌍🌎🌏 -Bienvenue sur Python 🐍 -Python 🐍 est bon en maths ! +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! 12345678987654321 -La date et l'heure sont 2023-11-21 16:27:24.101000 -Combien de faces y a-t-il sur ton dé ?:12 -C'est un D 12 -Tu as obtenu un 5 🔥🔥🔥🔥🔥 +The date and time is 2023-11-21 16:27:24.101000 +How many sides on your dice?:12 +That is a D 12 +You rolled a 5 🔥🔥🔥🔥🔥 ``` -
- -
- -### Astuce -La modification d’un type de données en un autre type de données est appelée **type casting**. +> [!TIP] +> +> Changing one type of data to another type of data is called **type casting**. -
\ No newline at end of file +Click the **Run** button, type a number of sides, and check that the dice roll can be any number from 1 up to the number you entered. diff --git a/fr-FR/step_16.md b/fr-FR/step_16.md index 510fa45..ab6acf4 100644 --- a/fr-FR/step_16.md +++ b/fr-FR/step_16.md @@ -1,38 +1,28 @@ -

À toi de jouer

- ---- task --- +## Over to you ➡️ S'entraîner à ajouter plus de lignes `print` à ton code. ---- /task --- - Voici quelques débuts de phrases que tu peux utiliser : ---- code --- ---- -language: python -line_numbers: true -line_number_start: 23 -line_highlights: 24-26 ---- - -roule_de() -print(f'J\'❤️ ...') -print(f'... me fait 😃') -print(f'Je voudrais faire ... avec {python}') - ---- /code --- - -
+```python line_numbers="true" line_number_start="23" line_highlights="24-26" -### Astuce +roll_dice() +print(f'I ❤️ ...') +print(f'... makes me 😃') +print(f'I would like to make ... with {python}') -Voici une liste d'emojis que tu pourrais utiliser : +``` -🎊 🙌 🙌🏼 🙌🏽 🙌🏾 🙌🏿 😃 🕒 🎨 🎮 🔬 🎉 🕶️ 🎲 😊 -🦄 🚀 💯 ⭐ 💛 ❤️ 📚 ⚽ 🏏 🏀 🥋 🏆 ✨ 🥺 🌈 🔥 ♻️ 🌳 -👩‍🦽👩🏼‍🦽👩🏽‍🦽👩🏾‍🦽👩🏿‍🦽🧘 🧘🏼 🧘🏽 🧘🏾 🧘🏿 🙋 🙋🏼 🙋🏽 🙋🏾 🙋🏿 +> [!TIP] +> +> Here is a list of some emojis you might like to use: +> +> 🎊 🙌 🙌🏼 🙌🏽 🙌🏾 🙌🏿 😃 🕒 🎨 🎮 🔬 🎉 🕶️ 🎲 😊 +> 🦄 🚀 💯 ⭐ 💛 ❤️ 📚 ⚽ 🏏 🏀 🥋 🏆 ✨ 🥺 🌈 🔥 ♻️ 🌳 +> 👩‍🦽👩🏼‍🦽👩🏽‍🦽👩🏾‍🦽👩🏿‍🦽🧘 🧘🏼 🧘🏽 🧘🏾 🧘🏿 🙋 🙋🏼 🙋🏽 🙋🏾 🙋🏿 +> +> You can copy and paste them into your code. -Tu peux les copier et les coller dans ton code. +## Now run your code -
+Click the **Run** button and check that your extra print lines show your own words and emojis after the dice roll. diff --git a/fr-FR/step_2.md b/fr-FR/step_2.md index 8329137..70beb18 100644 --- a/fr-FR/step_2.md +++ b/fr-FR/step_2.md @@ -1,37 +1,25 @@ -

Variables

- -
- -### Astuce - -Une **variable** est utilisée pour stocker des valeurs telles que du texte ou des nombres. Choisir un nom judicieux pour une variable te permet de te rappeler plus facilement à quoi elle sert. - -
+## Variables Nous avons inclus quelques variables qui stockent les caractères emoji. -
+> [!TIP] +> +> A **variable** is used to store values such as text or numbers. Choosing a sensible name for a variable makes it easier for you to remember what it is for. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 3 -line_highlights: 4-6 ---- +```python line_numbers="true" line_number_start="3" line_highlights="4-6" # variables -monde = '🌍🌎🌏' +world = '🌍🌎🌏' python = 'Python 🐍' -feu = '🔥' - -# Définitions de fonctions - -# Mettre le code à exécuter ci-dessous -print(f'Bonjour') +fire = '🔥' ---- /code --- +# Function definitions + +# Put code to run under here +print(f'Hello') -
+``` +## Now run your code +Click the **Run** button and check that the output still says `Hello`. diff --git a/fr-FR/step_3.md b/fr-FR/step_3.md index ffe9587..2a4c453 100644 --- a/fr-FR/step_3.md +++ b/fr-FR/step_3.md @@ -1,54 +1,37 @@ -

Imprimer des variables

- ---- task --- +## Print variables ➡️ Imprimer le contenu d'une variable. ---- /task --- - -Change ton code pour aussi `print()` le contenu de la variable `monde`. Tu peux le faire en ajoutant le nom de la variable entre accolades `{}` +Change ton code pour aussi `print()` le contenu de la variable `monde`. You can do this by adding the variable name in curly brackets `{}`. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 3 -line_highlights: 11 ---- +```python line_numbers="true" line_number_start="3" line_highlights="11" # variables -monde = '🌍🌎🌏' +world = '🌍🌎🌏' python = 'Python 🐍' -feu = '🔥' +fire = '🔥' -# Définitions de fonctions +# Function definitions + +# Put code to run under here +print(f'Hello {world}') -# Mettre le code à exécuter ci-dessous -print(f'Bonjour {monde}') +``` ---- /code --- +## Now run your code -**Test :** clique sur le bouton **Exécuter**. -Tu devrais voir ceci lorsque tu exécutes ton code. +This is what you should see when you run your code. -
``` Bonjour 🌍🌎🌏 ``` -
- -
- -### Astuce - -Le caractère `f` à l'intérieur de print te permet d'imprimer facilement des variables avec des chaînes de texte. - -
- -
-### Déboguer +> [!TIP] +> +> The `f` character inside the print lets you easily print variables along with strings of text. -Si tu obtiens une erreur, vérifie que tu as ouvert et fermé toutes tes parenthèses `()` et tes accolades `{}` +> [!DEBUG] +> +> If you get an error then check you have opened and closed all your brackets `()` and curly brackets `{}`. -
+Click the **Run** button and check that `Hello` is followed by the globe emojis. diff --git a/fr-FR/step_4.md b/fr-FR/step_4.md index 3790c52..2f3828c 100644 --- a/fr-FR/step_4.md +++ b/fr-FR/step_4.md @@ -1,33 +1,22 @@ -

Imprimer une autre variable

- ---- task --- - -➡️ Imprimer le contenu de la variable `python`. - ---- /task --- +## Print another variable **Ajoute** une autre ligne à ton code pour `print()` plus de texte et d'emojis : ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 12 ---- +```python line_numbers="true" line_number_start="10" line_highlights="12" -# Mettre le code à exécuter ci-dessous -print(f'Bonjour {monde}') -print(f'Bienvenue sur {python}') +# Put code to run under here +print(f'Hello {world}') +print(f'Welcome to {python}') ---- /code --- +``` + +## Now run your code -**Test :** clique sur le bouton **Exécuter**. -Tu devrais voir ceci lorsque tu exécutes ton code. +This is what you should see when you run your code. -
``` -Bonjour 🌍🌎🌏 -Bienvenue sur Python 🐍 +Hello 🌍🌎🌏 +Welcome to Python 🐍 ``` -
+ +Click the **Run** button and check that the output has two lines: `Hello` with the globe emojis and `Welcome to Python 🐍`. diff --git a/fr-FR/step_5.md b/fr-FR/step_5.md index 489874a..f99405d 100644 --- a/fr-FR/step_5.md +++ b/fr-FR/step_5.md @@ -1,11 +1,15 @@ -

Opérateurs

+## Operators -En Python, tu peux travailler avec des nombres et des dates. Tu peux utiliser des **opérateurs arithmétiques** tels que `+` et `-` pour effectuer des calculs : +In Python you can work with numbers and dates. -| + | addition | -| - | soustraction | -| * | multiplication | -| / | division | -| ** | puissance | +You can use **arithmetic operators** such as `+` and `-` to do calculations: +\| + | add | +\| - | subtract | +\| \* | multiply | +\| / | divide | +\| \*\* | exponent | +## Now run your code + +Click the **Run** button and check that the output is still the same as in the previous step, because you have not added any new code yet. diff --git a/fr-FR/step_6.md b/fr-FR/step_6.md index c3e9675..91abc62 100644 --- a/fr-FR/step_6.md +++ b/fr-FR/step_6.md @@ -1,53 +1,36 @@ -

Créer un calcul

- ---- task --- +## Create a calculation ➡️ Imprimer la valeur d'un calcul. ---- /task --- - Ajoute deux autres lignes `print()` à ton code, y compris une multiplication pour que Python puisse calculer : ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 13-14 ---- - -# Mettre le code à exécuter ci-dessous -print(f'Bonjour {monde}') -print(f'Bienvenue sur {python}') -print(f'{python} est bon en maths !') +```python line_numbers="true" line_number_start="10" line_highlights="13-14" + +# Put code to run under here +print(f'Hello {world}') +print(f'Welcome to {python}') +print(f'{python} is good at maths!') print(f'{111111111 * 111111111}') ---- /code --- +``` + +## Now run your code -**Test :** clique sur le bouton **Exécuter**. -Tu devrais voir ceci lorsque tu exécutes ton code. +This is what you should see when you run your code. -
``` -Bonjour 🌍🌎🌏 -Bienvenue sur Python 🐍 -Python 🐍 est bon en maths ! +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! 12345678987654321 ``` -
- -
- -### Astuce - -Python utilise les mêmes règles de calcul que celles que tu as peut-être apprises à l’école. **P**arenthèses d'abord, puis les **O**rdres, **D**ivision, **M**ultiplication, **A**ddition, et enfin **S**oustraction. - -
- -
-### Déboguer +> [!TIP] +> +> Python uses the same rules for calculations as you might have learned at school. **B**rackets first, then **O**rders, **D**ivision, **M**ultiplication, **A**ddition, and lastly **S**ubtraction. -N'oublie pas que les lettres MAJUSCULES et minuscules sont importantes en Python. Vérifie toujours que tu utilises la bonne case. +> [!DEBUG] +> +> Don't forget that the UPPERCASE and lowercase letters are important in Python. Always check you are using the correct case. -
+Click the **Run** button and check that your program now prints a maths message and a large number on the next line. diff --git a/fr-FR/step_7.md b/fr-FR/step_7.md index 8109afb..ea5c21d 100644 --- a/fr-FR/step_7.md +++ b/fr-FR/step_7.md @@ -1,44 +1,30 @@ -

Utilisation des modules

- ---- task --- +## Using modules ➡️ Importer le module `datetime`. ---- /task --- - Python possède de nombreux **modules** que tu peux utiliser dans ton code pour t'aider à effectuer certaines tâches. Pour utiliser un module, tu dois d’abord l’**importer**. Le module `datetime` aide à écrire du code qui utilise des dates et des heures. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 1 -line_highlights: 2 ---- +```python line_numbers="true" line_number_start="1" line_highlights="2" -# importations +# imports from datetime import datetime # variables ---- /code --- - -Quand tu exécutes ce code, rien ne devrait changer et tu devrais avoir le même résultat que l’étape précédente. - -
- -### Astuce - -Tout texte que tu écris en Python avec un `#` devant devient un commentaire. Ces lignes ne seront pas exécutées, elles peuvent donc être utiles pour aider les gens à lire et à comprendre ton code. +``` -
+When you run this code, nothing should change, and you should have the same output as the previous step. -
+> [!TIP] +> +> Any text you write in Python with a `#` in front of it becomes a comment. These lines won't run, so they can be useful to help people read and understand your code. -### Déboguer +> [!DEBUG] +> +> Check that you have spelled `datetime` correctly, and it is all lowercase. -Vérifie que tu as correctement orthographié `datetime` et que tout est en minuscules. +## Now run your code -
+Run your code and check that the output stays the same as in the previous step after importing `datetime`. diff --git a/fr-FR/step_8.md b/fr-FR/step_8.md index bdd6d5d..b62e313 100644 --- a/fr-FR/step_8.md +++ b/fr-FR/step_8.md @@ -1,46 +1,33 @@ -

Imprimer la date

- ---- task --- +## Print the date ➡️ Afficher la date et l'heure actuelles. ---- /task --- - Ajoute une autre ligne à ton code pour `print` la date et l'heure actuelles. Obtiens la date et l'heure actuelles en utilisant la fonction `now()` du module `datetime` : ---- code --- ---- -language: python -line_numbers: true -line_number_start: 14 -line_highlights: 16 ---- +```python line_numbers="true" line_number_start="14" line_highlights="16" -print(f'{python} est bon en maths !') +print(f'{python} is good at maths!') print(f'{111111111 * 111111111}') -print(f'La date et l\'heure sont {datetime.now()}') +print(f'The date and time is {datetime.now()}') + +``` ---- /code --- +## Now run your code -**Test :** clique sur le bouton **Exécuter**. -C'est ce que tu devrais voir lorsque tu exécutes ton code, mais la date et l'heure seront différentes. +This is what you should see when you run your code, but the date and time will be different. -
``` -Bonjour 🌍🌎🌏 -Bienvenue sur Python 🐍 -Python 🐍 est bon en maths ! +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! 12345678987654321 -La date et l'heure sont 2023-11-21 15:34:10.148000 +The date and time is 2023-11-21 15:34:10.148000 ``` -
- -
- -### Déboguer -Vérifie toutes tes parenthèses `()` et tes accolades `{}` pour t'assurer qu'ils sont tous ouverts et fermés au bon endroit. +> [!DEBUG] +> +> Check all your brackets `()` and curly brackets `{}` to make sure they are all opened and closed in the correct place. -
+Click the **Run** button and check that the output now includes a line that starts with `The date and time is`, followed by the current date and time. diff --git a/fr-FR/step_9.md b/fr-FR/step_9.md index 70ca1a4..d4395ad 100644 --- a/fr-FR/step_9.md +++ b/fr-FR/step_9.md @@ -1,25 +1,26 @@ -

Fonctions

+## Functions -Les fonctions sont des blocs de code qui exécutent des tâches spécifiques. Elles peuvent être utilisées à l'infini. +Functions are blocks of code that perform specific tasks. -Voici un exemple de fonction : +They can be used over and over again. ---- code --- ---- -language: python -line_numbers: false ---- +Here is an example of a function: -# Définitions de fonctions -def ajoute_un_et_un(): +```python + +# Function definitions +def add_one_and_one(): x = 1 + 1 print(x) ---- /code --- +``` + +The name of this function is `add_one_and_one`. -Le nom de cette fonction est `ajoute_un_et_un`. +The code for the task you want the function to do needs to be **indented**, which means that you need to add **four spaces** before each line of code. -Le code de la tâche que tu souhaites que la fonction effectue doit être **indenté**, ce qui signifie que tu dois ajouter **quatre espaces** avant chaque ligne de code. +**Calling** a function runs the code inside it. You **call** a function by using its name. In this case `add_one_and_one()`. -**L'appel** d'une fonction exécute le code qu'elle contient. Tu **appelles** une fonction en utilisant son nom. Ici, `ajoute_un_et_un()`. +## Now run your code +Run your code and check that nothing new is printed yet, because the function has been defined but not called. diff --git a/nl-NL/code/complete/main.py b/nl-NL/code/complete/main.py index d1cb052..e991db2 100644 --- a/nl-NL/code/complete/main.py +++ b/nl-NL/code/complete/main.py @@ -11,11 +11,11 @@ def gooi_dobbelsteen(): max = input('Hoeveel zijden heeft je dobbelsteen?:') print(f'Dat is een D {max}') worp = randint(1, int(max)) - print(f'Je hebt een {worp} {vuur * worp} gegooid') + print(f'Je hebt een {worp} {vuur * worp}') gegooid # Zet de code om uit te voeren hieronder print(f'Hallo {wereld}') -print(f'Welkom bij {python}') +print(f"Welkom bij {python}') print(f'{python} is goed in wiskunde!') print(f'{111111111 * 111111111}') print(f'De datum en tijd zijn {datetime.now()}') diff --git a/nl-NL/code/starter/main.py b/nl-NL/code/starter/main.py index e12625b..159f9d3 100644 --- a/nl-NL/code/starter/main.py +++ b/nl-NL/code/starter/main.py @@ -1,11 +1,11 @@ # imports -# variabelen -wereld = '🌍🌎🌏' +# variables +world = '🌍🌎🌏' python = 'Python 🐍' -vuur = '🔥' +fire = '🔥' -# Functiedefinities +# Function definitions -# Zet de code om uit te voeren hieronder +# Put code to run under here diff --git a/nl-NL/landing.md b/nl-NL/landing.md new file mode 100644 index 0000000..0eba53c --- /dev/null +++ b/nl-NL/landing.md @@ -0,0 +1,7 @@ +## What you will make + +Write an interactive program in Python that uses emojis 🙌 🙌🏼 🙌🏽 🙌🏾 🙌🏿. + +Click on the **Run** button. + + diff --git a/nl-NL/meta.yml b/nl-NL/meta.yml index ff7f01d..a467767 100644 --- a/nl-NL/meta.yml +++ b/nl-NL/meta.yml @@ -1,40 +1,49 @@ ---- -title: "Editor Hallo 🌍🌎🌏" +title: "Editor Hallo \U0001F30D\U0001F30E\U0001F30F" hero_image: images/banner.png description: Schrijf een interactief Python-project dat emoji gebruikt meta_title: Python programmeerprojecten voor kinderen en tieners | Hallo wereld meta_description: Leer Python met de Raspberry Pi Foundation. Maak een interactief Python programmeerproject dat emoji's gebruikt. version: 4 -listed: false +listed: true copyedit: false last_tested: "2021-10-06" +landing: true steps: - - title: step 1 - - title: step 2 + - + title: Print Hello + - + title: Variabelen completion: - engaged - - title: step 3 - - title: step 4 - - title: step 5 - - title: step 6 - - title: step 7 - - title: step 8 - - title: step 9 - - title: step 10 - - title: step 11 - - title: step 12 - - title: step 13 - - title: step 14 - - title: step 15 - - title: step 16 + - + title: Variabelen afdrukken + - + title: Een andere variabele afdrukken + - + title: Operatoren + - + title: Maak een berekening + - + title: Modules gebruiken + - + title: Druk de datum af + - + title: Functies + - + title: Gooi dobbelstenen + - + title: Importeer randint + - + title: Willekeurige getallen + - + title: Tekenreeksen vermenigvuldigen + - + title: Invoer ophalen + - + title: Verander de dobbelstenen completion: - internal - - title: step 17 - knowledge_quiz: - path: quiz1 - version: 1 - questions: 3 - passing_score: 3 - - title: step 18 + - + title: Nu ben jij aan de beurt completion: - external diff --git a/nl-NL/step_1.md b/nl-NL/step_1.md index 11506d6..428a517 100644 --- a/nl-NL/step_1.md +++ b/nl-NL/step_1.md @@ -1,54 +1,33 @@ -

Print Hallo

+## Print Hello ---- task --- +➡️ Display the word 'Hello' on the screen. -➡️ Toon het woord 'Hallo' op het scherm +In Python, `print()` outputs strings (words or numbers) to the screen. ---- /task --- +Type the code to `print()` Hello to the screen: -In Python geeft `print()`{:.language-python} tekenreeksen (woorden of getallen) weer op het scherm. +```python line_numbers="true" line_number_start="10" line_highlights="11" -Typ de code voor `print()`{:.language-python} Hallo op het scherm: +# Put code to run under here. +print(f'Hello') -
- ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 11 ---- - -# Zet de code om uit te voeren hieronder. -print(f'Hallo') - ---- /code --- +``` -
+## Now run your code -**Test:** Klik op de **Run** knop. -Dit is wat je zou moeten zien wanneer je jouw code uitvoert. +This is what you should see when you run your code. -
``` Hallo ``` -
- -
- -### Tip - -Wanneer je een openingshaakje `(`{:.language-python} typt, zal de code-editor automatisch een sluitingshaakje `)`{:.language-python} toevoegen -Dit gebeurt ook wanneer je een openingsapostrof `'`{:.language-python} typt. - -
- -
-### Foutopsporing +> [!TIP] +> +> When you type an opening bracket `(` the code editor will automatically add a closing bracket `)`. +> This also happens when you type an opening apostrophe `'`. -Als je een foutmelding krijgt, controleer dan zorgvuldig jouw code. Controleer of er enkele aanhalingstekens rond `Hallo`{:.language-python} staan, zodat Python weet dat het tekst moet zijn. +> [!DEBUG] +> +> If you get an error then check your code really carefully. Check there are single quotes around `Hello` so Python knows it is meant to be text. -
+Click the **Run** button and check that `Hello` appears in the output. diff --git a/nl-NL/step_10.md b/nl-NL/step_10.md index a980a10..46b4a98 100644 --- a/nl-NL/step_10.md +++ b/nl-NL/step_10.md @@ -1,72 +1,46 @@ -

Gooi dobbelstenen

- ---- task --- +## Roll dice ➡️ Maak een functie om het gooien van een dobbelsteen te simuleren. -➡️ Roep de functie aan om de code erin uit te voeren. - ---- /task --- - -Maak een functie genaamd `gooi_dobbelsteen()`, die het getal 4 afdrukt. +Create a function called `roll_dice()` that prints out the number 4. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 9 -line_highlights: 10, 11 ---- +```python line_numbers="true" line_number_start="9" line_highlights="10,11" -# Functiedefinities +# Function definitions +def roll_dice(): + print(f'You rolled a {4}') + +# Put code to run under here -def gooi_dobbelsteen(): - print(f'Je hebt een {4} gegooid') - -# Zet de code om uit te voeren hier onder +``` ---- /code --- +Then, call the function at the bottom of your code. -Roep vervolgens de functie onderaan je code aan. +```python line_numbers="true" line_number_start="18" line_highlights="19" +print(f'The date and time is {datetime.now()}') +roll_dice() ---- code --- ---- -language: python -line_numbers: true -line_number_start: 18 -line_highlights: 19 ---- -print(f'De datum en tijd zijn {datetime.now()}') -gooi_dobbelsteen() +``` ---- /code --- +## Now run your code -**Test:** Klik op de **Run** knop. -Dit is wat je zou moeten zien wanneer je jouw code uitvoert. +This is what you should see when you run your code. -
``` -Hallo 🌍🌎🌏 -Welkom bij Python 🐍 -Python 🐍 is goed in wiskunde! +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! 12345678987654321 -De datum en tijd zijn 2023-11-21 15:55:33.038000 -Je hebt een 4 gegooid +The date and time is 2023-11-21 15:55:33.038000 +You rolled a 4 ``` -
- -
- -### Tip - -Je kunt de **Tab**-toets op jouw toetsenbord gebruiken om 4 spaties in te voegen. Door op **Shift** en **Tab** te drukken, worden de 4 spaties verwijderd. - -
- -
-### Foutopsporing +> [!TIP] +> +> You can use the **Tab** key on your keyboard to insert 4 spaces. Pressing **Shift** and **Tab** will remove the 4 spaces. -Controleer of er haakjes `()` en een dubbele punt `:` aan het einde van jouw functiedefinitie staan. Controleer ook of je haakjes `()` gebruikt wanneer je jouw functie aanroept. +> [!DEBUG] +> +> Check that you have brackets `()` and a colon `:` at the end of your function definition. Also check you are using brackets `()` when you call your function. -
+Click the **Run** button and check that the last line says `You rolled a 4`. diff --git a/nl-NL/step_11.md b/nl-NL/step_11.md index f5ad17f..7873995 100644 --- a/nl-NL/step_11.md +++ b/nl-NL/step_11.md @@ -1,26 +1,19 @@ -

Importeer randint

- ---- task --- +## Import randint ➡️ Importeer de `randint`-functie vanuit de `random`-module. ---- /task --- - -Een andere module, genaamd `random`, kan worden gebruikt om willekeurige getallen te creëren +Another module called `random` can be used to create random numbers. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 1 -line_highlights: 3 ---- +```python line_numbers="true" line_number_start="1" line_highlights="3" -# import +# imports from datetime import datetime from random import randint ---- /code --- +``` + +Your code output will not change when you run it. -De uitvoer van jouw code verandert niet wanneer je deze uitvoert. +## Now run your code +Run your code and check that the output stays the same as in the previous step after importing `randint`. diff --git a/nl-NL/step_12.md b/nl-NL/step_12.md index b1aaec1..ca8edfb 100644 --- a/nl-NL/step_12.md +++ b/nl-NL/step_12.md @@ -1,53 +1,36 @@ -

Willekeurige getallen

- ---- task --- +## Random numbers ➡️ Kies een willekeurig getal voor de dobbelsteenworp. ---- /task --- - Gebruik de `randint`-functie die je hebt geïmporteerd om een willekeurig getal tussen 1 en 6 te kiezen voor de dobbelsteenworp. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 12 ---- +```python line_numbers="true" line_number_start="10" line_highlights="12" -# Functiedefinities -def gooi_dobbelsteen(): - print(f'Je hebt een {randint(1, 6)} gegooid') +# Function definitions +def roll_dice(): + print(f'You rolled a {randint(1, 6)}') + +``` ---- /code --- +## Now run your code -**Test:** Klik op de **Run** knop. -Wanneer je nu je code nog eens uitvoert, zal er elke keer een nieuw willekeurig getal tussen 1 en 6 worden gekozen. +Now when you run your code, a new random number between 1 and 6 will be chosen each time. -
``` -Hallo 🌍🌎🌏 -Welkom bij Python 🐍 -Python 🐍 is goed in wiskunde! +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! 12345678987654321 -De datum en tijd zijn 2023-11-21 16:02:12.535000 -Je hebt een 6 gegooid +The date and time is 2023-11-21 16:02:12.535000 +You rolled a 6 ``` -
- -
- -### Tip - -`randint` is de afkorting van random integer. Integers zijn gehele getallen. - -
- -
-### Foutopsporing +> [!TIP] +> +> `randint` is short for random integer. Integers are whole numbers. -Controleer de haakjes en accolades als je een foutmelding krijgt. Houd er rekening mee dat hetzelfde getal steeds opnieuw gekozen kan worden. Het is willekeurig! +> [!DEBUG] +> +> Check your brackets and curly brackets if you get an error. Take note that the same number might be chosen over and over again. It's random! -
+Click the **Run** button and check that the last line says `You rolled a` followed by a number from 1 to 6. diff --git a/nl-NL/step_13.md b/nl-NL/step_13.md index 2a268a5..e35c96a 100644 --- a/nl-NL/step_13.md +++ b/nl-NL/step_13.md @@ -1,65 +1,45 @@ -

Tekenreeksen vermenigvuldigen

+## Multiply strings ---- task --- - -➡️ Sla het willekeurige getal op in een variabele. ➡️ Vermenigvuldig het getal met de 🔥-emoji om de emoji een aantal keer af te drukken dat gelijk is aan de worp van de dobbelsteen. ---- /task --- - In Python kun je tekenreeksen zoals emoji's of hele woorden vermenigvuldigen met een getal, zodat ze meerdere keren worden geprint. Sla het willekeurige getal op in een variabele met de naam `worp`. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 12 ---- +```python line_numbers="true" line_number_start="10" line_highlights="12" -# Functiedefinities -def gooi_dobbelsteen(): - worp = randint(1,6) +# Function definitions +def roll_dice(): + roll = randint(1,6) ---- /code --- +``` -Vermenigvuldig het willekeurige getal in `worp` met de 🔥 emoji en druk het resultaat af. +Multiply the random number stored in `roll` by the 🔥 emoji, and print the result. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 13 ---- +```python line_numbers="true" line_number_start="10" line_highlights="13" -# Functiedefinities -def gooi_dobbelsteen(): - worp = randint(1,6) - print(f'Je hebt een {worp} {fire * worp} gegooid') +# Function definitions +def roll_dice(): + roll = randint(1,6) + print(f'You rolled a {roll} {fire * roll}') + +``` ---- /code --- +## Now run your code -**Test:** Klik op de **Run** knop. -Je uitvoer zou er ongeveer zo uit moeten zien: +Your output code should look something like this: -
``` -Hallo 🌍🌎🌏 -Welkom bij Python 🐍 -Python 🐍 is goed in wiskunde! +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! 12345678987654321 -De datum en tijd zijn 2023-11-21 16:14:45.140000 -Je hebt een 4 gegooid 🔥🔥🔥🔥 +The date and time is 2023-11-21 16:14:45.140000 +You rolled a 4 🔥🔥🔥🔥 ``` -
- -
- -### Foutopsporing -Controleer of alle haakjes hetzelfde zijn als in het bovenstaande codevoorbeeld. +> [!DEBUG] +> +> Check all your brackets are the same as the code example above. -
+Click the **Run** button and check that the last line shows the dice number and the same number of fire emojis. diff --git a/nl-NL/step_14.md b/nl-NL/step_14.md index 6b23a75..8c4aeb2 100644 --- a/nl-NL/step_14.md +++ b/nl-NL/step_14.md @@ -1,44 +1,35 @@ -

Invoer ophalen

- ---- task --- +## Get input ➡️ Laat de persoon die jouw programma gebruikt, iets invoeren. ---- /task --- - Met `input()` kun je de persoon die jouw programma gebruikt vragen om tekst in te voeren en deze tekst als variabele opslaan. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 12-13 ---- +```python line_numbers="true" line_number_start="10" line_highlights="12-13" -# Functiedefinities -def gooi_dobbelsteen(): - max = input('Hoeveel zijden heeft je dobbelsteen?:') - print(f'Dat is een D {max}') - worp = randint(1,6) - print(f'Je hebt een {worp} {vuur * worp} gegooid') +# Function definitions +def roll_dice(): + max = input('How many sides on your dice?:') + print(f'That is a D {max}') + roll = randint(1,6) + print(f'You rolled a {roll} {fire * roll}') ---- /code --- +``` -**Test:** Klik op de **Run** knop. -Zorg ervoor dat je op de knop Enter klikt nadat je het aantal kanten hebt ingevoerd. -Dit is wat je zou moeten zien wanneer je jouw code uitvoert. +## Now run your code + +Ensure you press the Enter key after inputting how many sides. +This is what you should see when you run your code. -
``` -Hallo 🌍🌎🌏 -Welkom bij Python 🐍 -Python 🐍 is goed in wiskunde! +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! 12345678987654321 -De datum en tijd zijn 2023-11-21 16:20:41.323000 -Hoeveel zijden heeft je dobbelsteen?: +The date and time is 2023-11-21 16:20:41.323000 +How many sides on your dice?: 20 -Dat is een D 20 -Je hebt een 1 gegooid 🔥 +That is a D 20 +You rolled a 1 🔥 ``` -
+ +Click the **Run** button, type a number such as `20`, and check that the program says `That is a D 20` before showing a dice roll. diff --git a/nl-NL/step_15.md b/nl-NL/step_15.md index 44a51e7..b26cbf4 100644 --- a/nl-NL/step_15.md +++ b/nl-NL/step_15.md @@ -1,54 +1,39 @@ -

Verander de dobbelstenen

+## Change the dice ---- task --- - -➡️ Wijzig de invoergegevens naar een geheel getal. ➡️ Genereer een willekeurig getal tussen 1 en het aantal zijden dat de gebruiker heeft ingevoerd. ---- /task --- - Invoer wordt altijd opgeslagen als tekst, maar we moeten de invoer in `max` gebruiken om het grootste getal op te geven dat kan worden geworpen. `max` is een tekenreeks en moet daarom worden gewijzigd naar een integer `int()`. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 14 ---- - -# Functiedefinities +```python line_numbers="true" line_number_start="10" line_highlights="14" -def gooi_dobbelsteen(): - max = input('Hoeveel zijden heeft je dobbelsteen?:') - print(f'Dat is een D {max}') - worp = randint(1, int(max)) - print(f'Je hebt een {worp} {vuur * worp} gegooid') +# Function definitions +def roll_dice(): + max = input('How many sides on your dice?:') + print(f'That is a D {max}') + roll = randint(1, int(max)) + print(f'You rolled a {roll} {fire * roll}') + +``` ---- /code --- +## Now run your code -**Test:** Klik op de **Run** knop. -Dit is wat je zou moeten zien: +This is what you should see: -
``` -Hallo 🌍🌎🌏 -Welkom bij Python 🐍 -Python 🐍 is goed in wiskunde! +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! 12345678987654321 -De datum en tijd zijn 2023-11-21 16:27:24.101000 -Hoeveel zijden heeft je dobbelsteen?:12 -Dat is een D 12 -Je hebt een 5 gegooid 🔥🔥🔥🔥🔥 +The date and time is 2023-11-21 16:27:24.101000 +How many sides on your dice?:12 +That is a D 12 +You rolled a 5 🔥🔥🔥🔥🔥 ``` -
- -
- -### Tip -Het veranderen van het ene gegevenstype naar het andere gegevenstype wordt **type casting** genoemd. +> [!TIP] +> +> Changing one type of data to another type of data is called **type casting**. -
\ No newline at end of file +Click the **Run** button, type a number of sides, and check that the dice roll can be any number from 1 up to the number you entered. diff --git a/nl-NL/step_16.md b/nl-NL/step_16.md index 834251a..a2eccfd 100644 --- a/nl-NL/step_16.md +++ b/nl-NL/step_16.md @@ -1,38 +1,28 @@ -

Nu ben jij aan de beurt

- ---- task --- +## Over to you ➡️ Oefen met het toevoegen van meer `print`-regels aan je code. ---- /task --- - Hier zijn enkele startzinnen die je kunt gebruiken: ---- code --- ---- -language: python -line_numbers: true -line_number_start: 23 -line_highlights: 24-26 ---- - -gooi_dobbelsteen() -print(f'Ik ❤️ ...') -print(f'... maakt mij 😃') -print(f'Ik zou graag ... willen maken met {python}') - ---- /code --- - -
+```python line_numbers="true" line_number_start="23" line_highlights="24-26" -### Tip +roll_dice() +print(f'I ❤️ ...') +print(f'... makes me 😃') +print(f'I would like to make ... with {python}') -Hier is een lijst met emoji's die je zou kunnen gebruiken: +``` -🎊 🙌 🙌🏼 🙌🏽 🙌🏾 🙌🏿 😃 🕒 🎨 🎮 🔬 🎉 🕶️ 🎲 😊 -🦄 🚀 💯 ⭐ 💛 ❤️ 📚 ⚽ 🏏 🏀 🥋 🏆 ✨ 🥺 🌈 🔥 ♻️ 🌳 -👩‍🦽👩🏼‍🦽👩🏽‍🦽👩🏾‍🦽👩🏿‍🦽🧘 🧘🏼 🧘🏽 🧘🏾 🧘🏿 🙋 🙋🏼 🙋🏽 🙋🏾 🙋🏿 +> [!TIP] +> +> Here is a list of some emojis you might like to use: +> +> 🎊 🙌 🙌🏼 🙌🏽 🙌🏾 🙌🏿 😃 🕒 🎨 🎮 🔬 🎉 🕶️ 🎲 😊 +> 🦄 🚀 💯 ⭐ 💛 ❤️ 📚 ⚽ 🏏 🏀 🥋 🏆 ✨ 🥺 🌈 🔥 ♻️ 🌳 +> 👩‍🦽👩🏼‍🦽👩🏽‍🦽👩🏾‍🦽👩🏿‍🦽🧘 🧘🏼 🧘🏽 🧘🏾 🧘🏿 🙋 🙋🏼 🙋🏽 🙋🏾 🙋🏿 +> +> You can copy and paste them into your code. -Je kunt ze kopiëren en plakken in jouw code. +## Now run your code -
+Click the **Run** button and check that your extra print lines show your own words and emojis after the dice roll. diff --git a/nl-NL/step_2.md b/nl-NL/step_2.md index 9fbebcd..6ea7901 100644 --- a/nl-NL/step_2.md +++ b/nl-NL/step_2.md @@ -1,38 +1,25 @@ -

Variabelen

- -
- -### Tip - -Een **variabele** wordt gebruikt om waarden zoals tekst of getallen op te slaan. Als je een logische naam kiest voor een variabele, dan kun je later gemakkelijker onthouden waarvoor deze dient. - -
+## Variables We hebben enkele variabelen opgenomen die emoji-tekens opslaan. -
+> [!TIP] +> +> A **variable** is used to store values such as text or numbers. Choosing a sensible name for a variable makes it easier for you to remember what it is for. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 3 -line_highlights: 4-6 ---- +```python line_numbers="true" line_number_start="3" line_highlights="4-6" -# variabelen -wereld = '🌍🌎🌏' +# variables +world = '🌍🌎🌏' python = 'Python 🐍' -vuur = '🔥' - -# Functiedefinities - -# Zet de code om uit te voeren hier onder - -print(f'Hallo') +fire = '🔥' ---- /code --- +# Function definitions + +# Put code to run under here +print(f'Hello') -
+``` +## Now run your code +Click the **Run** button and check that the output still says `Hello`. diff --git a/nl-NL/step_3.md b/nl-NL/step_3.md index a0c7a22..9ab19b5 100644 --- a/nl-NL/step_3.md +++ b/nl-NL/step_3.md @@ -1,55 +1,37 @@ -

Variabelen afdrukken

- ---- task --- +## Print variables ➡️ De inhoud van een variabele afdrukken. ---- /task --- - -Wijzig je code zodat ook er een `print()` wordt gedaan van de inhoud van de `wereld` variabele. Je kan dit doen door de variabelenaam tussen accolades `{}` toe te voegen +Wijzig je code zodat ook er een 'print()' wordt gedaan van de inhoud van de 'wereld' variabele. You can do this by adding the variable name in curly brackets `{}`. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 3 -line_highlights: 11 ---- +```python line_numbers="true" line_number_start="3" line_highlights="11" -# variabelen -wereld = '🌍🌎🌏' +# variables +world = '🌍🌎🌏' python = 'Python 🐍' -vuur = '🔥' - -# Functiedefinities +fire = '🔥' -# Zet de code om uit te voeren hier onder +# Function definitions + +# Put code to run under here +print(f'Hello {world}') -print(f'Hallo {wereld}') +``` ---- /code --- +## Now run your code -**Test:** Klik op de **Run** knop. -Dit is wat je zou moeten zien wanneer je jouw code uitvoert. +This is what you should see when you run your code. -
``` Hallo 🌍🌎🌏 ``` -
- -
- -### Tip - -Met het teken `f` in het print commando kun je eenvoudig variabelen samen met tekstreeksen afdrukken. - -
- -
-### Foutopsporing +> [!TIP] +> +> The `f` character inside the print lets you easily print variables along with strings of text. -Als je een foutmelding krijgt, controleer dan of je alle haakjes `()` en accolades `{}` hebt geopend en gesloten +> [!DEBUG] +> +> If you get an error then check you have opened and closed all your brackets `()` and curly brackets `{}`. -
+Click the **Run** button and check that `Hello` is followed by the globe emojis. diff --git a/nl-NL/step_4.md b/nl-NL/step_4.md index 760b680..f3528e0 100644 --- a/nl-NL/step_4.md +++ b/nl-NL/step_4.md @@ -1,33 +1,22 @@ -

Een andere variabele afdrukken

+## Print another variable ---- task --- +**Voeg** nog een regel toe aan je code om meer tekst en emojis te 'print()'en: -➡️ De inhoud van de variabele `python` afdrukken. +```python line_numbers="true" line_number_start="10" line_highlights="12" ---- /task --- +# Put code to run under here +print(f'Hello {world}') +print(f'Welcome to {python}') -**Voeg** nog een regel toe aan je code om meer tekst en emojis te `print()`en: - ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 12 ---- - -# Zet de code om uit te voeren hier onder -print(f'Hallo {wereld}') -print(f'Welkom bij {python}') +``` ---- /code --- +## Now run your code -**Test:** Klik op de **Run** knop. -Dit is wat je zou moeten zien wanneer je jouw code uitvoert. +This is what you should see when you run your code. -
``` -Hallo 🌍🌎🌏 -Welkom bij Python 🐍 +Hello 🌍🌎🌏 +Welcome to Python 🐍 ``` -
+ +Click the **Run** button and check that the output has two lines: `Hello` with the globe emojis and `Welcome to Python 🐍`. diff --git a/nl-NL/step_5.md b/nl-NL/step_5.md index d47f4ee..f99405d 100644 --- a/nl-NL/step_5.md +++ b/nl-NL/step_5.md @@ -1,11 +1,15 @@ -

Operatoren

+## Operators -In Python kun je met getallen en data werken. Je kunt **rekenkundige operatoren** gebruiken, zoals `+` en `-` om berekeningen uit te voeren: +In Python you can work with numbers and dates. -| + | optellen | -| - | aftrekken | -| * | vermenigvuldigen | -| / | delen | -| ** | machtsverheffen | +You can use **arithmetic operators** such as `+` and `-` to do calculations: +\| + | add | +\| - | subtract | +\| \* | multiply | +\| / | divide | +\| \*\* | exponent | +## Now run your code + +Click the **Run** button and check that the output is still the same as in the previous step, because you have not added any new code yet. diff --git a/nl-NL/step_6.md b/nl-NL/step_6.md index be9afe4..638ae3c 100644 --- a/nl-NL/step_6.md +++ b/nl-NL/step_6.md @@ -1,54 +1,36 @@ -

Maak een berekening

- ---- task --- +## Create a calculation ➡️ De waarde van een berekening afdrukken. ---- /task --- - -Voeg nog twee `print()` regels toe aan je code, inclusief een vermenigvuldiging die Python moet berekenen: - ---- code --- ---- -language: python -line_numbers: true -line_number_start: 10 -line_highlights: 13-14 ---- +Voeg nog twee 'print()' regels toe aan je code, inclusief een vermenigvuldiging die Python moet berekenen: -# Zet de code om uit te voeren hier onder +```python line_numbers="true" line_number_start="10" line_highlights="13-14" -print(f'Hallo {wereld}') -print(f'Welkom bij {python}') -print(f'{python} is goed in wiskunde!') +# Put code to run under here +print(f'Hello {world}') +print(f'Welcome to {python}') +print(f'{python} is good at maths!') print(f'{111111111 * 111111111}') ---- /code --- +``` + +## Now run your code -**Test:** Klik op de **Run** knop. -Dit is wat je zou moeten zien wanneer je jouw code uitvoert. +This is what you should see when you run your code. -
``` -Hallo 🌍🌎🌏 -Welkom bij Python 🐍 -Python 🐍 is goed in wiskunde! +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! 12345678987654321 ``` -
- -
- -### Tip - -Python gebruikt dezelfde regels voor berekeningen die je op school hebt geleerd. BODMAS: **B**rackets (haakjes) eerst, dan **O**rders (machten), **D**ivision (deling), **M**ultiplication (vermenigvuldiging), **A**ddition (optellen) en als laatste **S**ubtraction (aftrekken). - -
- -
-### Foutopsporing +> [!TIP] +> +> Python uses the same rules for calculations as you might have learned at school. **B**rackets first, then **O**rders, **D**ivision, **M**ultiplication, **A**ddition, and lastly **S**ubtraction. -Vergeet niet dat HOOFDLETTERS en kleine letters belangrijk zijn in Python. Controleer altijd of je de juiste lettergrootte gebruikt. +> [!DEBUG] +> +> Don't forget that the UPPERCASE and lowercase letters are important in Python. Always check you are using the correct case. -
+Click the **Run** button and check that your program now prints a maths message and a large number on the next line. diff --git a/nl-NL/step_7.md b/nl-NL/step_7.md index 3e16d5d..ca162ee 100644 --- a/nl-NL/step_7.md +++ b/nl-NL/step_7.md @@ -1,45 +1,30 @@ -

Modules gebruiken

- ---- task --- +## Using modules ➡️ Importeer de `datetime`-module. ---- /task --- - Python heeft veel **modules** die je in jouw code kunt gebruiken om bepaalde taken uit te voeren. Om een module te kunnen gebruiken, moet je deze eerst **importeren**. De `datetime`-module helpt bij het schrijven van code die gebruikmaakt van data en tijden. ---- code --- ---- -language: python -line_numbers: true -line_number_start: 1 -line_highlights: 2 ---- - -# import +```python line_numbers="true" line_number_start="1" line_highlights="2" +# imports from datetime import datetime -# variabelen - ---- /code --- - -Wanneer je deze code uitvoert, zou er niets moeten veranderen en zou je dezelfde uitvoer moeten krijgen als in de vorige stap. - -
- -### Tip +# variables -Elke tekst die je in Python schrijft met een `#` ervoor, wordt een opmerking. Deze regels worden niet uitgevoerd en kunnen daarom nuttig zijn om mensen te helpen jouw code te lezen en begrijpen. +``` -
+When you run this code, nothing should change, and you should have the same output as the previous step. -
+> [!TIP] +> +> Any text you write in Python with a `#` in front of it becomes a comment. These lines won't run, so they can be useful to help people read and understand your code. -### Foutopsporing +> [!DEBUG] +> +> Check that you have spelled `datetime` correctly, and it is all lowercase. -Controleer of je `datetime` correct hebt gespeld en of het alleen in kleine letters is. +## Now run your code -
+Run your code and check that the output stays the same as in the previous step after importing `datetime`. diff --git a/nl-NL/step_8.md b/nl-NL/step_8.md index 6c166ac..1907939 100644 --- a/nl-NL/step_8.md +++ b/nl-NL/step_8.md @@ -1,46 +1,33 @@ -

Druk de datum af

- ---- task --- +## Print the date ➡️ De huidige datum en tijd weergeven. ---- /task --- - -Voeg nog een regel toe aan je code om de huidige datum en tijd te `print`-en. +Voeg nog een regel toe aan je code om de huidige datum en tijd te 'print'-en. -Haal de huidige datum en tijd op door de functie `now()` uit de `datetime`-module te gebruiken: +Haal de huidige datum en tijd op door de functie 'now()' uit de datetime -module te gebruiken: ---- code --- ---- -language: python -line_numbers: true -line_number_start: 14 -line_highlights: 16 ---- +```python line_numbers="true" line_number_start="14" line_highlights="16" -print(f'{python} is goed in wiskunde!') +print(f'{python} is good at maths!') print(f'{111111111 * 111111111}') -print(f'De datum en tijd zijn {datetime.now()}') +print(f'The date and time is {datetime.now()}') + +``` ---- /code --- +## Now run your code -**Test:** Klik op de **Run** knop. -Dit is wat je zou moeten zien wanneer je jouw code uitvoert, maar de datum en tijd zullen anders zijn. +This is what you should see when you run your code, but the date and time will be different. -
``` -Hallo 🌍🌎🌏 -Welkom bij Python 🐍 -Python 🐍 is goed in wiskunde! +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! 12345678987654321 -De datum en tijd zijn 2023-11-21 15:34:10.148000 +The date and time is 2023-11-21 15:34:10.148000 ``` -
- -
- -### Foutopsporing -Controleer alle haakjes `()` en accolades `{}` en zorg ervoor dat ze allemaal op de juiste plaats geopend en gesloten zijn. +> [!DEBUG] +> +> Check all your brackets `()` and curly brackets `{}` to make sure they are all opened and closed in the correct place. -
+Click the **Run** button and check that the output now includes a line that starts with `The date and time is`, followed by the current date and time. diff --git a/nl-NL/step_9.md b/nl-NL/step_9.md index 451a1ac..d4395ad 100644 --- a/nl-NL/step_9.md +++ b/nl-NL/step_9.md @@ -1,26 +1,26 @@ -

Functies

+## Functions -Functies zijn codeblokken die specifieke taken uitvoeren. Ze kunnen steeds opnieuw gebruikt worden. +Functions are blocks of code that perform specific tasks. -Hier is een voorbeeld van een functie: +They can be used over and over again. ---- code --- ---- -language: python -line_numbers: false ---- +Here is an example of a function: -# Functiedefinities +```python -def tel_een_en_een_op(): +# Function definitions +def add_one_and_one(): x = 1 + 1 print(x) ---- /code --- +``` -De naam van deze functie is `tel_een_en_een_op`. +The name of this function is `add_one_and_one`. -De code voor de taak die je wilt dat de functie uitvoert, moet ingesprongen zijn, wat betekent dat je **vier spaties** moet toevoegen vóór elke regel code. +The code for the task you want the function to do needs to be **indented**, which means that you need to add **four spaces** before each line of code. -Door een functie **aan te roepen**, wordt de code erbinnen uitgevoerd. Het **aanroepen** van een functie doe je door de naam in te typen. In dit geval `tel_een_en_een_op()`. +**Calling** a function runs the code inside it. You **call** a function by using its name. In this case `add_one_and_one()`. +## Now run your code + +Run your code and check that nothing new is printed yet, because the function has been defined but not called. diff --git a/uk-UA/code/complete/main.py b/uk-UA/code/complete/main.py new file mode 100644 index 0000000..47000a3 --- /dev/null +++ b/uk-UA/code/complete/main.py @@ -0,0 +1,25 @@ +# Імпортуємо +from datetime import datetime +from random import randint + +world = '🌍🌎🌏' +python = 'Python 🐍' +fire = '🔥' + +# Визначення функцій +def roll_dice(): + max = input('Кількість сторін кубика:') + print(f'Цей кубик називається D {max}') + roll = randint(1, int(max)) + print(f'Тобі випало число {roll} {fire * roll}') + +# Нижче розмісти код, який потрібно виконати +print('Привіт,' {world}') +print(f'Ласкаво просимо до {python}') +print(f'{python} знається на математиці!') +print(f'{111111111 * 111111111}') +print(f'Дата й час — {datetime.now()}') +roll_dice() # Виклич функцію, яка кидає кубик +print(f'Я ❤️ ...') +print(f'... викликає у мене 😃') +print(f'Я хочу створювати ... у {python}') diff --git a/uk-UA/code/complete/project_config.yml b/uk-UA/code/complete/project_config.yml new file mode 100644 index 0000000..cc3a9bf --- /dev/null +++ b/uk-UA/code/complete/project_config.yml @@ -0,0 +1,4 @@ +name: "Привіт, 🌍🌎🌏" +identifier: "editor-hello-world-complete" +type: 'python' +build: true diff --git a/uk-UA/code/starter/main.py b/uk-UA/code/starter/main.py new file mode 100644 index 0000000..159f9d3 --- /dev/null +++ b/uk-UA/code/starter/main.py @@ -0,0 +1,11 @@ +# imports + +# variables +world = '🌍🌎🌏' +python = 'Python 🐍' +fire = '🔥' + +# Function definitions + +# Put code to run under here + diff --git a/uk-UA/code/starter/project_config.yml b/uk-UA/code/starter/project_config.yml new file mode 100644 index 0000000..8044742 --- /dev/null +++ b/uk-UA/code/starter/project_config.yml @@ -0,0 +1,4 @@ +name: "Привіт, 🌍🌎🌏" +identifier: "editor-hello-world-starter" +type: 'python' +build: true diff --git a/uk-UA/images/banner.png b/uk-UA/images/banner.png new file mode 100644 index 0000000..a6bd889 Binary files /dev/null and b/uk-UA/images/banner.png differ diff --git a/uk-UA/images/blue-points.png b/uk-UA/images/blue-points.png new file mode 100644 index 0000000..5768422 Binary files /dev/null and b/uk-UA/images/blue-points.png differ diff --git a/uk-UA/images/comma_error.png b/uk-UA/images/comma_error.png new file mode 100644 index 0000000..224bfe7 Binary files /dev/null and b/uk-UA/images/comma_error.png differ diff --git a/uk-UA/images/full_screen.png b/uk-UA/images/full_screen.png new file mode 100644 index 0000000..b45cc1f Binary files /dev/null and b/uk-UA/images/full_screen.png differ diff --git a/uk-UA/images/hello_error.png b/uk-UA/images/hello_error.png new file mode 100644 index 0000000..32d2a38 Binary files /dev/null and b/uk-UA/images/hello_error.png differ diff --git a/uk-UA/images/indent_error.png b/uk-UA/images/indent_error.png new file mode 100644 index 0000000..9874040 Binary files /dev/null and b/uk-UA/images/indent_error.png differ diff --git a/uk-UA/images/quiz1.png b/uk-UA/images/quiz1.png new file mode 100644 index 0000000..88df9a0 Binary files /dev/null and b/uk-UA/images/quiz1.png differ diff --git a/uk-UA/images/quiz2.png b/uk-UA/images/quiz2.png new file mode 100644 index 0000000..b39b5d8 Binary files /dev/null and b/uk-UA/images/quiz2.png differ diff --git a/uk-UA/images/quiz3.png b/uk-UA/images/quiz3.png new file mode 100644 index 0000000..af55813 Binary files /dev/null and b/uk-UA/images/quiz3.png differ diff --git a/uk-UA/images/roll_dice.png b/uk-UA/images/roll_dice.png new file mode 100644 index 0000000..4c274da Binary files /dev/null and b/uk-UA/images/roll_dice.png differ diff --git a/uk-UA/images/run_hello.png b/uk-UA/images/run_hello.png new file mode 100644 index 0000000..c89c369 Binary files /dev/null and b/uk-UA/images/run_hello.png differ diff --git a/uk-UA/images/run_hello_world.png b/uk-UA/images/run_hello_world.png new file mode 100644 index 0000000..88df9a0 Binary files /dev/null and b/uk-UA/images/run_hello_world.png differ diff --git a/uk-UA/images/run_multiple.png b/uk-UA/images/run_multiple.png new file mode 100644 index 0000000..e1b8aa7 Binary files /dev/null and b/uk-UA/images/run_multiple.png differ diff --git a/uk-UA/images/say_hello.png b/uk-UA/images/say_hello.png new file mode 100644 index 0000000..e1b8aa7 Binary files /dev/null and b/uk-UA/images/say_hello.png differ diff --git a/uk-UA/images/sentence_starter.png b/uk-UA/images/sentence_starter.png new file mode 100644 index 0000000..c3d9b67 Binary files /dev/null and b/uk-UA/images/sentence_starter.png differ diff --git a/uk-UA/images/showcase_static.png b/uk-UA/images/showcase_static.png new file mode 100644 index 0000000..196c0cb Binary files /dev/null and b/uk-UA/images/showcase_static.png differ diff --git a/uk-UA/images/starter_project.png b/uk-UA/images/starter_project.png new file mode 100644 index 0000000..cc90493 Binary files /dev/null and b/uk-UA/images/starter_project.png differ diff --git a/uk-UA/images/sums_dates.png b/uk-UA/images/sums_dates.png new file mode 100644 index 0000000..574bc1f Binary files /dev/null and b/uk-UA/images/sums_dates.png differ diff --git a/uk-UA/images/upgrade_ideas.png b/uk-UA/images/upgrade_ideas.png new file mode 100644 index 0000000..53bcd64 Binary files /dev/null and b/uk-UA/images/upgrade_ideas.png differ diff --git a/uk-UA/landing.md b/uk-UA/landing.md new file mode 100644 index 0000000..0eba53c --- /dev/null +++ b/uk-UA/landing.md @@ -0,0 +1,7 @@ +## What you will make + +Write an interactive program in Python that uses emojis 🙌 🙌🏼 🙌🏽 🙌🏾 🙌🏿. + +Click on the **Run** button. + + diff --git a/uk-UA/meta.yml b/uk-UA/meta.yml new file mode 100644 index 0000000..f7d8616 --- /dev/null +++ b/uk-UA/meta.yml @@ -0,0 +1,49 @@ +title: "Привіт, \U0001F30D\U0001F30E\U0001F30F у редакторі коду" +hero_image: images/banner.png +description: Створи інтерактивний проєкт на Python, який використовує емоджі +meta_title: Проєкти з кодування для дітей і підлітків | Привіт, світе +meta_description: Вивчай Python разом з Raspberry Pi Foundation. Створи інтерактивний проєкт мовою програмування Python з використанням емоджі. +version: 4 +listed: true +copyedit: false +last_tested: "2021-10-06" +landing: true +steps: + - + title: Print Hello + - + title: Змінні + completion: + - engaged + - + title: Виведи змінні + - + title: Виведи ще одну змінну + - + title: Оператори + - + title: Створи розрахунок + - + title: Використання модулів + - + title: Виведи дату + - + title: Функції + - + title: Підкинь кубик + - + title: Імпортуй функцію randint + - + title: Випадкові числа + - + title: Помнож рядки + - + title: Отримай дані + - + title: Зміни кубик + completion: + - internal + - + title: Твоя черга! + completion: + - external diff --git a/uk-UA/python-comments.txt b/uk-UA/python-comments.txt new file mode 100644 index 0000000..d2b55d6 --- /dev/null +++ b/uk-UA/python-comments.txt @@ -0,0 +1,43 @@ +Нижче розмісти код, який потрібно виконати + +Вивести результати обчислення сум + +Виведення емодзі + +Помісти сюди визначення функцій + +Не забуваймо про двокрапку в кінці цього рядка + +Виклик функції roll_dice + +Генерація випадкового числа від 1 до 6 + +Отримати значення змінної roll + +Повторення емодзі вогню, яке відповідає результату випадіння рандомного числа + +Очікування на введення даних від користувача + +Використання числа, яке ввів користувач + +randint повинен мати значення max, щоб бути 'цілим числом' + +Очікування натискання користувачем клавіші Enter + +Корисні символи :',()*_/.# + +Змінні емодзі для подальшого використання у твоєму проєкті + +Додай альтернативи ASCII-артів + +Раніше ми використовували смайлики, зроблені з символів + +отримати вхідні дані від користувача + +згенерувати випадкове число + +повторити ємодзі вогню відповідно до числа кубика + +отримати поточну дату та час + +Виклик функції hobbies diff --git a/uk-UA/python-translatable.txt b/uk-UA/python-translatable.txt new file mode 100644 index 0000000..91bd006 --- /dev/null +++ b/uk-UA/python-translatable.txt @@ -0,0 +1,101 @@ +Привіт + +Ласкаво просимо в ... + +...дуже добре справляється з ... + +...- + +...може зробити ... + +Тобі випало число: ... + +Скільки сторін буде мати кубик? + +Тип твого кубика: D ... + +Я <3 ... + +...робить мене ... + +Я хотів би зробити ... у ... + +awesome + +Я вмію кодувати + +two_dice + +Перше число: + +Друге число: + +хобі + +хобі + +Що тобі подобається? + +Це звучить ... + +Ти можеш створити ... проєкт про ... + +roll_dice + +roll + +тепер + +world + +суми + +календар + +годинник + +projects + +веселощі + +кубики + +єдиноріг + +space + +щасливий + +дурний + +серце + +ігри + +книги + +спорт + +green + +природи + +fire + +блискітки + +благати + +сто + +зірка + +жовте_серце + +веселка + +Обери найбільше число: + +I <3 веселки + +В яблучко - 500 балів! diff --git a/uk-UA/step_1.md b/uk-UA/step_1.md new file mode 100644 index 0000000..6b57107 --- /dev/null +++ b/uk-UA/step_1.md @@ -0,0 +1,33 @@ +## Print Hello + +➡️ Display the word 'Hello' on the screen. + +In Python, `print()` outputs strings (words or numbers) to the screen. + +Type the code to `print()` Hello to the screen: + +```python line_numbers="true" line_number_start="10" line_highlights="11" + +# Put code to run under here. +print(f'Hello') + +``` + +## Now run your code + +This is what you should see when you run your code. + +``` +Привіт +``` + +> [!TIP] +> +> When you type an opening bracket `(` the code editor will automatically add a closing bracket `)`. +> This also happens when you type an opening apostrophe `'`. + +> [!DEBUG] +> +> If you get an error then check your code really carefully. Check there are single quotes around `Hello` so Python knows it is meant to be text. + +Click the **Run** button and check that `Hello` appears in the output. diff --git a/uk-UA/step_10.md b/uk-UA/step_10.md new file mode 100644 index 0000000..ad80c86 --- /dev/null +++ b/uk-UA/step_10.md @@ -0,0 +1,46 @@ +## Roll dice + +➡️ Створи функцію, яка кидатиме кубик. + +Create a function called `roll_dice()` that prints out the number 4. + +```python line_numbers="true" line_number_start="9" line_highlights="10,11" + +# Function definitions +def roll_dice(): + print(f'You rolled a {4}') + +# Put code to run under here + +``` + +Then, call the function at the bottom of your code. + +```python line_numbers="true" line_number_start="18" line_highlights="19" +print(f'The date and time is {datetime.now()}') +roll_dice() + +``` + +## Now run your code + +This is what you should see when you run your code. + +``` +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! +12345678987654321 +The date and time is 2023-11-21 15:55:33.038000 +You rolled a 4 +``` + +> [!TIP] +> +> You can use the **Tab** key on your keyboard to insert 4 spaces. Pressing **Shift** and **Tab** will remove the 4 spaces. + +> [!DEBUG] +> +> Check that you have brackets `()` and a colon `:` at the end of your function definition. Also check you are using brackets `()` when you call your function. + +Click the **Run** button and check that the last line says `You rolled a 4`. diff --git a/uk-UA/step_11.md b/uk-UA/step_11.md new file mode 100644 index 0000000..773f01a --- /dev/null +++ b/uk-UA/step_11.md @@ -0,0 +1,19 @@ +## Import randint + +➡️ Імпортуй функцію `randint` з модуля `random`. + +Another module called `random` can be used to create random numbers. + +```python line_numbers="true" line_number_start="1" line_highlights="3" + +# imports +from datetime import datetime +from random import randint + +``` + +Your code output will not change when you run it. + +## Now run your code + +Run your code and check that the output stays the same as in the previous step after importing `randint`. diff --git a/uk-UA/step_12.md b/uk-UA/step_12.md new file mode 100644 index 0000000..348c889 --- /dev/null +++ b/uk-UA/step_12.md @@ -0,0 +1,36 @@ +## Random numbers + +➡️ Отримай випадкове число для кидка кубика. + +Використай імпортовану тобою функцію `randint`, щоб отримати випадкове число від 1 до 6 для кидка кубика. + +```python line_numbers="true" line_number_start="10" line_highlights="12" + +# Function definitions +def roll_dice(): + print(f'You rolled a {randint(1, 6)}') + +``` + +## Now run your code + +Now when you run your code, a new random number between 1 and 6 will be chosen each time. + +``` +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! +12345678987654321 +The date and time is 2023-11-21 16:02:12.535000 +You rolled a 6 +``` + +> [!TIP] +> +> `randint` is short for random integer. Integers are whole numbers. + +> [!DEBUG] +> +> Check your brackets and curly brackets if you get an error. Take note that the same number might be chosen over and over again. It's random! + +Click the **Run** button and check that the last line says `You rolled a` followed by a number from 1 to 6. diff --git a/uk-UA/step_13.md b/uk-UA/step_13.md new file mode 100644 index 0000000..ef3795f --- /dev/null +++ b/uk-UA/step_13.md @@ -0,0 +1,45 @@ +## Multiply strings + +➡️ Помнож число на емоджі 🔥 — це виведе емоджі стільки разів, скільки випало на кубику. + +У Python ти можеш помножити на якесь число рядки, наприклад емоджі або цілі слова, і вони виводитимуться кілька разів. + +Збережи випадкове число у змінній під назвою `roll`. + +```python line_numbers="true" line_number_start="10" line_highlights="12" + +# Function definitions +def roll_dice(): + roll = randint(1,6) + +``` + +Multiply the random number stored in `roll` by the 🔥 emoji, and print the result. + +```python line_numbers="true" line_number_start="10" line_highlights="13" + +# Function definitions +def roll_dice(): + roll = randint(1,6) + print(f'You rolled a {roll} {fire * roll}') + +``` + +## Now run your code + +Your output code should look something like this: + +``` +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! +12345678987654321 +The date and time is 2023-11-21 16:14:45.140000 +You rolled a 4 🔥🔥🔥🔥 +``` + +> [!DEBUG] +> +> Check all your brackets are the same as the code example above. + +Click the **Run** button and check that the last line shows the dice number and the same number of fire emojis. diff --git a/uk-UA/step_14.md b/uk-UA/step_14.md new file mode 100644 index 0000000..aa8a87b --- /dev/null +++ b/uk-UA/step_14.md @@ -0,0 +1,35 @@ +## Get input + +➡️ Дай можливість людині, яка користується твоєю програмою, ввести власні дані. + +За допомогою функції `input()` (англійською «вхідні дані») ти можеш попросити людину, яка використовує твою програму, ввести якийсь текст. + +```python line_numbers="true" line_number_start="10" line_highlights="12-13" + +# Function definitions +def roll_dice(): + max = input('How many sides on your dice?:') + print(f'That is a D {max}') + roll = randint(1,6) + print(f'You rolled a {roll} {fire * roll}') + +``` + +## Now run your code + +Ensure you press the Enter key after inputting how many sides. +This is what you should see when you run your code. + +``` +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! +12345678987654321 +The date and time is 2023-11-21 16:20:41.323000 +How many sides on your dice?: +20 +That is a D 20 +You rolled a 1 🔥 +``` + +Click the **Run** button, type a number such as `20`, and check that the program says `That is a D 20` before showing a dice roll. diff --git a/uk-UA/step_15.md b/uk-UA/step_15.md new file mode 100644 index 0000000..21fcc27 --- /dev/null +++ b/uk-UA/step_15.md @@ -0,0 +1,39 @@ +## Change the dice + +➡️ Згенеруй випадкове число між 1 та кількістю сторін, яку ввів користувач. + +Вхідні дані завжди зберігаються як текст, але нам потрібно використати дані змінної `max`, щоб вказати найбільше число на кубику. + +`max` — це текстовий рядок, тому нам потрібно змінити його на ціле число за допомогою функції `int()`. + +```python line_numbers="true" line_number_start="10" line_highlights="14" + +# Function definitions +def roll_dice(): + max = input('How many sides on your dice?:') + print(f'That is a D {max}') + roll = randint(1, int(max)) + print(f'You rolled a {roll} {fire * roll}') + +``` + +## Now run your code + +This is what you should see: + +``` +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! +12345678987654321 +The date and time is 2023-11-21 16:27:24.101000 +How many sides on your dice?:12 +That is a D 12 +You rolled a 5 🔥🔥🔥🔥🔥 +``` + +> [!TIP] +> +> Changing one type of data to another type of data is called **type casting**. + +Click the **Run** button, type a number of sides, and check that the dice roll can be any number from 1 up to the number you entered. diff --git a/uk-UA/step_16.md b/uk-UA/step_16.md new file mode 100644 index 0000000..7b9e6ac --- /dev/null +++ b/uk-UA/step_16.md @@ -0,0 +1,28 @@ +## Over to you + +➡️ Додай більше рядків `print` до свого коду. + +Ось приклади речень, які ти можеш використати для початку: + +```python line_numbers="true" line_number_start="23" line_highlights="24-26" + +roll_dice() +print(f'I ❤️ ...') +print(f'... makes me 😃') +print(f'I would like to make ... with {python}') + +``` + +> [!TIP] +> +> Here is a list of some emojis you might like to use: +> +> 🎊 🙌 🙌🏼 🙌🏽 🙌🏾 🙌🏿 😃 🕒 🎨 🎮 🔬 🎉 🕶️ 🎲 😊 +> 🦄 🚀 💯 ⭐ 💛 ❤️ 📚 ⚽ 🏏 🏀 🥋 🏆 ✨ 🥺 🌈 🔥 ♻️ 🌳 +> 👩‍🦽👩🏼‍🦽👩🏽‍🦽👩🏾‍🦽👩🏿‍🦽🧘 🧘🏼 🧘🏽 🧘🏾 🧘🏿 🙋 🙋🏼 🙋🏽 🙋🏾 🙋🏿 +> +> You can copy and paste them into your code. + +## Now run your code + +Click the **Run** button and check that your extra print lines show your own words and emojis after the dice roll. diff --git a/uk-UA/step_2.md b/uk-UA/step_2.md new file mode 100644 index 0000000..1459e33 --- /dev/null +++ b/uk-UA/step_2.md @@ -0,0 +1,25 @@ +## Variables + +Ми вже додали декілька змінних, які зберігають емоджі. + +> [!TIP] +> +> A **variable** is used to store values such as text or numbers. Choosing a sensible name for a variable makes it easier for you to remember what it is for. + +```python line_numbers="true" line_number_start="3" line_highlights="4-6" + +# variables +world = '🌍🌎🌏' +python = 'Python 🐍' +fire = '🔥' + +# Function definitions + +# Put code to run under here +print(f'Hello') + +``` + +## Now run your code + +Click the **Run** button and check that the output still says `Hello`. diff --git a/uk-UA/step_3.md b/uk-UA/step_3.md new file mode 100644 index 0000000..04d99b0 --- /dev/null +++ b/uk-UA/step_3.md @@ -0,0 +1,37 @@ +## Print variables + +➡️ Виведи вміст змінної. + +Зміни свій код так, щоб він також виводив вміст змінної `world` (англійською «світ») на екран за допомогою `print()`. You can do this by adding the variable name in curly brackets `{}`. + +```python line_numbers="true" line_number_start="3" line_highlights="11" + +# variables +world = '🌍🌎🌏' +python = 'Python 🐍' +fire = '🔥' + +# Function definitions + +# Put code to run under here +print(f'Hello {world}') + +``` + +## Now run your code + +This is what you should see when you run your code. + +``` +Привіт, 🌍🌎🌏 +``` + +> [!TIP] +> +> The `f` character inside the print lets you easily print variables along with strings of text. + +> [!DEBUG] +> +> If you get an error then check you have opened and closed all your brackets `()` and curly brackets `{}`. + +Click the **Run** button and check that `Hello` is followed by the globe emojis. diff --git a/uk-UA/step_4.md b/uk-UA/step_4.md new file mode 100644 index 0000000..1465107 --- /dev/null +++ b/uk-UA/step_4.md @@ -0,0 +1,22 @@ +## Print another variable + +**Додай** ще один рядок до коду, щоб зробити `print()` додаткового тексту та емодзі: + +```python line_numbers="true" line_number_start="10" line_highlights="12" + +# Put code to run under here +print(f'Hello {world}') +print(f'Welcome to {python}') + +``` + +## Now run your code + +This is what you should see when you run your code. + +``` +Hello 🌍🌎🌏 +Welcome to Python 🐍 +``` + +Click the **Run** button and check that the output has two lines: `Hello` with the globe emojis and `Welcome to Python 🐍`. diff --git a/uk-UA/step_5.md b/uk-UA/step_5.md new file mode 100644 index 0000000..f99405d --- /dev/null +++ b/uk-UA/step_5.md @@ -0,0 +1,15 @@ +## Operators + +In Python you can work with numbers and dates. + +You can use **arithmetic operators** such as `+` and `-` to do calculations: + +\| + | add | +\| - | subtract | +\| \* | multiply | +\| / | divide | +\| \*\* | exponent | + +## Now run your code + +Click the **Run** button and check that the output is still the same as in the previous step, because you have not added any new code yet. diff --git a/uk-UA/step_6.md b/uk-UA/step_6.md new file mode 100644 index 0000000..b174dab --- /dev/null +++ b/uk-UA/step_6.md @@ -0,0 +1,36 @@ +## Create a calculation + +➡️ Виведи результат розрахунку. + +Додай ще два рядки `print()` до свого коду, де Python буде множити одне число на інше: + +```python line_numbers="true" line_number_start="10" line_highlights="13-14" + +# Put code to run under here +print(f'Hello {world}') +print(f'Welcome to {python}') +print(f'{python} is good at maths!') +print(f'{111111111 * 111111111}') + +``` + +## Now run your code + +This is what you should see when you run your code. + +``` +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! +12345678987654321 +``` + +> [!TIP] +> +> Python uses the same rules for calculations as you might have learned at school. **B**rackets first, then **O**rders, **D**ivision, **M**ultiplication, **A**ddition, and lastly **S**ubtraction. + +> [!DEBUG] +> +> Don't forget that the UPPERCASE and lowercase letters are important in Python. Always check you are using the correct case. + +Click the **Run** button and check that your program now prints a maths message and a large number on the next line. diff --git a/uk-UA/step_7.md b/uk-UA/step_7.md new file mode 100644 index 0000000..231d2ef --- /dev/null +++ b/uk-UA/step_7.md @@ -0,0 +1,30 @@ +## Using modules + +➡️ Імпортуй модуль `datetime`. + +Python має багато **модулів**, які ти можеш використовувати для виконання різних завдань. Щоб використати модуль, спочатку його потрібно **імпортувати**. + +Модуль `datetime` допомагає писати код, у якому є дата й час. + +```python line_numbers="true" line_number_start="1" line_highlights="2" + +# imports +from datetime import datetime + +# variables + +``` + +When you run this code, nothing should change, and you should have the same output as the previous step. + +> [!TIP] +> +> Any text you write in Python with a `#` in front of it becomes a comment. These lines won't run, so they can be useful to help people read and understand your code. + +> [!DEBUG] +> +> Check that you have spelled `datetime` correctly, and it is all lowercase. + +## Now run your code + +Run your code and check that the output stays the same as in the previous step after importing `datetime`. diff --git a/uk-UA/step_8.md b/uk-UA/step_8.md new file mode 100644 index 0000000..dadbe60 --- /dev/null +++ b/uk-UA/step_8.md @@ -0,0 +1,33 @@ +## Print the date + +➡️ Виведи поточну дату та час. + +Додай ще один рядок до коду, щоб зробити `print()` поточної дати й часу. + +Отримати поточну дату та час можна за допомогою функції `now()` з модуля `datetime`: + +```python line_numbers="true" line_number_start="14" line_highlights="16" + +print(f'{python} is good at maths!') +print(f'{111111111 * 111111111}') +print(f'The date and time is {datetime.now()}') + +``` + +## Now run your code + +This is what you should see when you run your code, but the date and time will be different. + +``` +Hello 🌍🌎🌏 +Welcome to Python 🐍 +Python 🐍 is good at maths! +12345678987654321 +The date and time is 2023-11-21 15:34:10.148000 +``` + +> [!DEBUG] +> +> Check all your brackets `()` and curly brackets `{}` to make sure they are all opened and closed in the correct place. + +Click the **Run** button and check that the output now includes a line that starts with `The date and time is`, followed by the current date and time. diff --git a/uk-UA/step_9.md b/uk-UA/step_9.md new file mode 100644 index 0000000..d4395ad --- /dev/null +++ b/uk-UA/step_9.md @@ -0,0 +1,26 @@ +## Functions + +Functions are blocks of code that perform specific tasks. + +They can be used over and over again. + +Here is an example of a function: + +```python + +# Function definitions +def add_one_and_one(): + x = 1 + 1 + print(x) + +``` + +The name of this function is `add_one_and_one`. + +The code for the task you want the function to do needs to be **indented**, which means that you need to add **four spaces** before each line of code. + +**Calling** a function runs the code inside it. You **call** a function by using its name. In this case `add_one_and_one()`. + +## Now run your code + +Run your code and check that nothing new is printed yet, because the function has been defined but not called.