diff --git a/de-DE/code/starter/main.py b/de-DE/code/starter/main.py new file mode 100644 index 0000000..a68ddac --- /dev/null +++ b/de-DE/code/starter/main.py @@ -0,0 +1,11 @@ +# Ingredients +protein = 'TOFU' +veg_1 = 'CARROT' +veg_2 = 'PEAS' +carb = 'RICE' +side = 'BOILED EGGS' +garnish = 'MINT' +emoji = '🍽️😋' + +# Final recipe print +print(f'Start with a scoop of {carb}',f'Top with diced {veg_1} and {veg_2}',f'Add grilled {protein}',f'Garnish with {garnish}',f'Serve with a side of {side}') \ No newline at end of file diff --git a/de-DE/code/starter/project_config.yml b/de-DE/code/starter/project_config.yml new file mode 100644 index 0000000..3d8d40c --- /dev/null +++ b/de-DE/code/starter/project_config.yml @@ -0,0 +1,4 @@ +name: "Python bytes - Recipe wreckers" +identifier: "python-bytes-recipe-wreckers" +type: 'python' +build: true diff --git a/de-DE/images/banner.png b/de-DE/images/banner.png new file mode 100644 index 0000000..454465b Binary files /dev/null and b/de-DE/images/banner.png differ diff --git a/de-DE/meta.yml b/de-DE/meta.yml new file mode 100644 index 0000000..912eb26 --- /dev/null +++ b/de-DE/meta.yml @@ -0,0 +1,21 @@ +title: Python bytes - Recipe wreckers +hero_image: images/banner.png +description: Create and secretly sabotage a recipe using Python print formatting and string methods. +meta_title: Python coding projects for kids and teens | Recipe Wreckers +meta_description: Learn Python with the Raspberry Pi Foundation. Make and secretly ruin a recipe using print(), f-strings, emoji, and .replace(). +version: 1 +listed: true +copyedit: false +last_tested: "2025-04-04" +steps: + - title: step_1 + - title: step_2 + completion: + - engaged + - title: step_3 + - title: step_4 + - title: step_5 + - title: step_6 + completion: + - internal + - external diff --git a/de-DE/resources/mentor.md b/de-DE/resources/mentor.md new file mode 100644 index 0000000..b5d1f85 --- /dev/null +++ b/de-DE/resources/mentor.md @@ -0,0 +1,47 @@ +# Mentor Notes: Recipe Wreckers + +## Overview + +This lesson builds on the basics of `print()` and f-strings by introducing: + +- Print formatting using `sep=` and `end=` +- String case methods (`.lower()`) +- Pranking techniques with `.replace()` +- Visual enhancement with emoji + +Learners take an existing recipe and gradually transform it into something easier to read, then secretly sabotage it for fun. + +--- + +## What They Will Learn + +- How to split long lines of code for readability +- How to use `sep='\n'` to add line breaks +- How to insert emoji as bullet points +- How to use `.lower()` for styling +- How to use `.replace()` for creative pranks + +--- + +## Tips + +- Encourage experimentation with emoji +- Learners should run code before and after each step to understand the impact +- Reinforce that `.replace()` doesn’t change the original string — it returns a new one + +--- + +## Challenges + +- Ensuring correct placement of `sep=`, especially when using emoji + newline +- Using `.replace()` safely without breaking strings +- Managing variable names consistently between tasks + +--- + +## Extension Ideas + +- Ask learners to write their own recipe and sabotage it +- Introduce `.count()` or `.find()` to inspect string contents +- Create a two-option prank menu using conditionals (if ready) + diff --git a/de-DE/solutions/main.py b/de-DE/solutions/main.py new file mode 100644 index 0000000..304a1f6 --- /dev/null +++ b/de-DE/solutions/main.py @@ -0,0 +1,17 @@ +emoji = '🍽️😋'.replace('😋', '🤢') + +protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD +veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT +carb = 'RICE'.replace('R', 'L') # ➝ LICE +veg_2 = 'PEAS' +garnish = 'MINT' +side = 'BOILED EGGS' + +print( + f'{emoji} Start with a scoop of {carb.lower()}', + f'Top with diced {veg_1.lower()} and {veg_2.lower()}', + f'Add grilled {protein.title()}', + f'Garnish with {garnish.lower()}', + f'Serve with a side of {side.lower()}', + sep='\n' +) diff --git a/de-DE/step_1.md b/de-DE/step_1.md new file mode 100644 index 0000000..e94d874 --- /dev/null +++ b/de-DE/step_1.md @@ -0,0 +1,50 @@ +

Make the code easier to read

+ +\--- task --- + +Split the long print statement onto multiple lines so it’s easier to understand. + +\--- /task --- + +

Readable code is good code

+ +A café manager has written all the recipe print parts on one long line — it works, but it's hard to read! + +Luckily, Python lets you write long `print()` statements across multiple lines. +You just need to **end each part with a comma**, and Python will still treat it as one command. + +--- + +**Run the program once** before making changes and look at the output. +Then split the print statement across multiple lines and run it again. +The output should be the same — but the code is much easier to read! + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: +--- + +print( +f'Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}' +) + +\--- /code --- + +
+ +
+ +### Tip + +Make sure you leave **commas** at the end of each line inside the print statement! + +
diff --git a/de-DE/step_2.md b/de-DE/step_2.md new file mode 100644 index 0000000..4f7bf91 --- /dev/null +++ b/de-DE/step_2.md @@ -0,0 +1,50 @@ +

Fix the output format

+ +\--- task --- + +Use `sep='\n'` to print each part of the recipe on its own line. + +\--- /task --- + +

Split the output into lines

+ +Right now, all the recipe lines appear squashed together. +You can use the `sep=` option in `print()` to tell Python what to put **between** each item. + +By setting `sep='\n'`, you’ll get a **new line** between every part of the print. + +Here’s what your code should look like: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 17 +--- + +print( +f'Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}', +sep='\n' +) + +\--- /code --- + +
+ +
+ +### Debugging + +If your recipe is still on one line, check: + +- Did you add `sep='\n'` at the end of the `print()`? +- Are the commas in place after each line? + +
diff --git a/de-DE/step_3.md b/de-DE/step_3.md new file mode 100644 index 0000000..5c9d299 --- /dev/null +++ b/de-DE/step_3.md @@ -0,0 +1,49 @@ +

Add emoji bullets

+ +\--- task --- + +Use the emoji variable to add a bullet point to every line. + +\--- /task --- + +

Make your list look amazing

+ +Now that the lines are separated, let’s add some bullet points! + +You can do this by changing the separator again, this time to `sep='\n' + emoji`. + +Also, you’ll want to manually add the emoji at the **start of the first line**, since `sep` only adds it _between_ lines. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 12, 17 +--- + +print( +f'{emoji}Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}', +sep='\n' + emoji +) + +\--- /code --- + +
+ +
+ +### Tip + +Try changing the `emoji` variable at the top to something cute like:
+• 🍽️😋
+• 🧁
+• 🍱 + +
diff --git a/de-DE/step_4.md b/de-DE/step_4.md new file mode 100644 index 0000000..616168b --- /dev/null +++ b/de-DE/step_4.md @@ -0,0 +1,40 @@ +

Fix the ingredient formatting

+ +\--- task --- + +Use `.title()` and `.lower()` on the ingredient values inside the `print()` line. + +\--- /task --- + +

Make the ingredients readable

+ +The ingredients are written in all uppercase — let’s make them easier to read in the final recipe. + +- Use `.lower()` to make all the letters lowercase + +Update each of the `print()` lines. Two lines have been done for you below. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 14 +line_highlights: +--- + +f'Add grilled {protein.lower()}' +f'Garnish with {garnish.lower()}' + +\--- /code --- + +
+ +
+ +### Debugging + +Make sure your parentheses and curly braces match correctly when calling `.lower()` inside a string. + +
diff --git a/de-DE/step_5.md b/de-DE/step_5.md new file mode 100644 index 0000000..dc10299 --- /dev/null +++ b/de-DE/step_5.md @@ -0,0 +1,43 @@ +

Sabotage the recipe with .replace()

+ +\--- task --- + +Use `.replace()` to secretly swap ingredients with disgusting ones! + +\--- /task --- + +

Let the prank begin

+ +Now that your recipe looks beautiful… it’s time to ruin it 😂 + +Use `.replace()` to quietly change the values of your variables **at the top** of your code. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 2 +line_highlights: +--- + +protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD +veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT + +\--- /code --- + +
+ +
+ +### Tip + +Here are more ideas: + +- PEAS ➝ FLEAS +- RICE ➝ LICE +- BOILED EGGS ➝ SPOILED EGGS +- MINT ➝ PAINT + +
diff --git a/de-DE/step_6.md b/de-DE/step_6.md new file mode 100644 index 0000000..6ccaf1f --- /dev/null +++ b/de-DE/step_6.md @@ -0,0 +1,60 @@ +

Replace the emoji for fun (or horror)

+ +\--- task --- + +Use `.replace()` on the emoji variable to turn cute bullets into creepy ones. + +\--- /task --- + +

Change the mood with emoji

+ +Your emoji bullets look tasty — but let’s change that! + +Use `.replace()` on the `emoji` variable to turn happy symbols into something horrible. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🍽️😋'.replace('😋', '🤢') # ➝ 🍽️🤢 + +\--- /code --- + +
+ +Or replace the whole thing completely: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🪳💀' + +\--- /code --- + +
+ +
+ +### Tip + +Other emoji options to try:
+• 🦗
+• 💩
+• 🧟
+• ☠️
+• 🐛 + +
\ No newline at end of file diff --git a/es-419/code/starter/main.py b/es-419/code/starter/main.py new file mode 100644 index 0000000..a68ddac --- /dev/null +++ b/es-419/code/starter/main.py @@ -0,0 +1,11 @@ +# Ingredients +protein = 'TOFU' +veg_1 = 'CARROT' +veg_2 = 'PEAS' +carb = 'RICE' +side = 'BOILED EGGS' +garnish = 'MINT' +emoji = '🍽️😋' + +# Final recipe print +print(f'Start with a scoop of {carb}',f'Top with diced {veg_1} and {veg_2}',f'Add grilled {protein}',f'Garnish with {garnish}',f'Serve with a side of {side}') \ No newline at end of file diff --git a/es-419/code/starter/project_config.yml b/es-419/code/starter/project_config.yml new file mode 100644 index 0000000..3d8d40c --- /dev/null +++ b/es-419/code/starter/project_config.yml @@ -0,0 +1,4 @@ +name: "Python bytes - Recipe wreckers" +identifier: "python-bytes-recipe-wreckers" +type: 'python' +build: true diff --git a/es-419/images/banner.png b/es-419/images/banner.png new file mode 100644 index 0000000..454465b Binary files /dev/null and b/es-419/images/banner.png differ diff --git a/es-419/meta.yml b/es-419/meta.yml new file mode 100644 index 0000000..912eb26 --- /dev/null +++ b/es-419/meta.yml @@ -0,0 +1,21 @@ +title: Python bytes - Recipe wreckers +hero_image: images/banner.png +description: Create and secretly sabotage a recipe using Python print formatting and string methods. +meta_title: Python coding projects for kids and teens | Recipe Wreckers +meta_description: Learn Python with the Raspberry Pi Foundation. Make and secretly ruin a recipe using print(), f-strings, emoji, and .replace(). +version: 1 +listed: true +copyedit: false +last_tested: "2025-04-04" +steps: + - title: step_1 + - title: step_2 + completion: + - engaged + - title: step_3 + - title: step_4 + - title: step_5 + - title: step_6 + completion: + - internal + - external diff --git a/es-419/resources/mentor.md b/es-419/resources/mentor.md new file mode 100644 index 0000000..b5d1f85 --- /dev/null +++ b/es-419/resources/mentor.md @@ -0,0 +1,47 @@ +# Mentor Notes: Recipe Wreckers + +## Overview + +This lesson builds on the basics of `print()` and f-strings by introducing: + +- Print formatting using `sep=` and `end=` +- String case methods (`.lower()`) +- Pranking techniques with `.replace()` +- Visual enhancement with emoji + +Learners take an existing recipe and gradually transform it into something easier to read, then secretly sabotage it for fun. + +--- + +## What They Will Learn + +- How to split long lines of code for readability +- How to use `sep='\n'` to add line breaks +- How to insert emoji as bullet points +- How to use `.lower()` for styling +- How to use `.replace()` for creative pranks + +--- + +## Tips + +- Encourage experimentation with emoji +- Learners should run code before and after each step to understand the impact +- Reinforce that `.replace()` doesn’t change the original string — it returns a new one + +--- + +## Challenges + +- Ensuring correct placement of `sep=`, especially when using emoji + newline +- Using `.replace()` safely without breaking strings +- Managing variable names consistently between tasks + +--- + +## Extension Ideas + +- Ask learners to write their own recipe and sabotage it +- Introduce `.count()` or `.find()` to inspect string contents +- Create a two-option prank menu using conditionals (if ready) + diff --git a/es-419/solutions/main.py b/es-419/solutions/main.py new file mode 100644 index 0000000..304a1f6 --- /dev/null +++ b/es-419/solutions/main.py @@ -0,0 +1,17 @@ +emoji = '🍽️😋'.replace('😋', '🤢') + +protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD +veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT +carb = 'RICE'.replace('R', 'L') # ➝ LICE +veg_2 = 'PEAS' +garnish = 'MINT' +side = 'BOILED EGGS' + +print( + f'{emoji} Start with a scoop of {carb.lower()}', + f'Top with diced {veg_1.lower()} and {veg_2.lower()}', + f'Add grilled {protein.title()}', + f'Garnish with {garnish.lower()}', + f'Serve with a side of {side.lower()}', + sep='\n' +) diff --git a/es-419/step_1.md b/es-419/step_1.md new file mode 100644 index 0000000..e94d874 --- /dev/null +++ b/es-419/step_1.md @@ -0,0 +1,50 @@ +

Make the code easier to read

+ +\--- task --- + +Split the long print statement onto multiple lines so it’s easier to understand. + +\--- /task --- + +

Readable code is good code

+ +A café manager has written all the recipe print parts on one long line — it works, but it's hard to read! + +Luckily, Python lets you write long `print()` statements across multiple lines. +You just need to **end each part with a comma**, and Python will still treat it as one command. + +--- + +**Run the program once** before making changes and look at the output. +Then split the print statement across multiple lines and run it again. +The output should be the same — but the code is much easier to read! + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: +--- + +print( +f'Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}' +) + +\--- /code --- + +
+ +
+ +### Tip + +Make sure you leave **commas** at the end of each line inside the print statement! + +
diff --git a/es-419/step_2.md b/es-419/step_2.md new file mode 100644 index 0000000..4f7bf91 --- /dev/null +++ b/es-419/step_2.md @@ -0,0 +1,50 @@ +

Fix the output format

+ +\--- task --- + +Use `sep='\n'` to print each part of the recipe on its own line. + +\--- /task --- + +

Split the output into lines

+ +Right now, all the recipe lines appear squashed together. +You can use the `sep=` option in `print()` to tell Python what to put **between** each item. + +By setting `sep='\n'`, you’ll get a **new line** between every part of the print. + +Here’s what your code should look like: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 17 +--- + +print( +f'Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}', +sep='\n' +) + +\--- /code --- + +
+ +
+ +### Debugging + +If your recipe is still on one line, check: + +- Did you add `sep='\n'` at the end of the `print()`? +- Are the commas in place after each line? + +
diff --git a/es-419/step_3.md b/es-419/step_3.md new file mode 100644 index 0000000..5c9d299 --- /dev/null +++ b/es-419/step_3.md @@ -0,0 +1,49 @@ +

Add emoji bullets

+ +\--- task --- + +Use the emoji variable to add a bullet point to every line. + +\--- /task --- + +

Make your list look amazing

+ +Now that the lines are separated, let’s add some bullet points! + +You can do this by changing the separator again, this time to `sep='\n' + emoji`. + +Also, you’ll want to manually add the emoji at the **start of the first line**, since `sep` only adds it _between_ lines. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 12, 17 +--- + +print( +f'{emoji}Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}', +sep='\n' + emoji +) + +\--- /code --- + +
+ +
+ +### Tip + +Try changing the `emoji` variable at the top to something cute like:
+• 🍽️😋
+• 🧁
+• 🍱 + +
diff --git a/es-419/step_4.md b/es-419/step_4.md new file mode 100644 index 0000000..616168b --- /dev/null +++ b/es-419/step_4.md @@ -0,0 +1,40 @@ +

Fix the ingredient formatting

+ +\--- task --- + +Use `.title()` and `.lower()` on the ingredient values inside the `print()` line. + +\--- /task --- + +

Make the ingredients readable

+ +The ingredients are written in all uppercase — let’s make them easier to read in the final recipe. + +- Use `.lower()` to make all the letters lowercase + +Update each of the `print()` lines. Two lines have been done for you below. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 14 +line_highlights: +--- + +f'Add grilled {protein.lower()}' +f'Garnish with {garnish.lower()}' + +\--- /code --- + +
+ +
+ +### Debugging + +Make sure your parentheses and curly braces match correctly when calling `.lower()` inside a string. + +
diff --git a/es-419/step_5.md b/es-419/step_5.md new file mode 100644 index 0000000..dc10299 --- /dev/null +++ b/es-419/step_5.md @@ -0,0 +1,43 @@ +

Sabotage the recipe with .replace()

+ +\--- task --- + +Use `.replace()` to secretly swap ingredients with disgusting ones! + +\--- /task --- + +

Let the prank begin

+ +Now that your recipe looks beautiful… it’s time to ruin it 😂 + +Use `.replace()` to quietly change the values of your variables **at the top** of your code. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 2 +line_highlights: +--- + +protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD +veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT + +\--- /code --- + +
+ +
+ +### Tip + +Here are more ideas: + +- PEAS ➝ FLEAS +- RICE ➝ LICE +- BOILED EGGS ➝ SPOILED EGGS +- MINT ➝ PAINT + +
diff --git a/es-419/step_6.md b/es-419/step_6.md new file mode 100644 index 0000000..6ccaf1f --- /dev/null +++ b/es-419/step_6.md @@ -0,0 +1,60 @@ +

Replace the emoji for fun (or horror)

+ +\--- task --- + +Use `.replace()` on the emoji variable to turn cute bullets into creepy ones. + +\--- /task --- + +

Change the mood with emoji

+ +Your emoji bullets look tasty — but let’s change that! + +Use `.replace()` on the `emoji` variable to turn happy symbols into something horrible. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🍽️😋'.replace('😋', '🤢') # ➝ 🍽️🤢 + +\--- /code --- + +
+ +Or replace the whole thing completely: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🪳💀' + +\--- /code --- + +
+ +
+ +### Tip + +Other emoji options to try:
+• 🦗
+• 💩
+• 🧟
+• ☠️
+• 🐛 + +
\ No newline at end of file diff --git a/fr-FR/code/starter/main.py b/fr-FR/code/starter/main.py new file mode 100644 index 0000000..46e2575 --- /dev/null +++ b/fr-FR/code/starter/main.py @@ -0,0 +1,11 @@ +# Ingrédients +proteine = 'TOFU' +legume_1 = 'CAROTTE' +legume_2 = 'POIS' +glucides = 'RIZ' +accompagnement = 'ŒUFS CUITS DUR' +garniture = 'MENTHE' +emoji = '🍽️😋' + +# Impression de la recette finale +print(f'Commencez par une boule de {glucide}',f'Garnissez de dés de {legume_1} et de {legume_2}',f'Ajoutez des {proteine} grillées',f'Décorez avec {garniture}',f'Servez avec un accompagnement de {accompagnement}') \ No newline at end of file diff --git a/fr-FR/code/starter/project_config.yml b/fr-FR/code/starter/project_config.yml new file mode 100644 index 0000000..4583d84 --- /dev/null +++ b/fr-FR/code/starter/project_config.yml @@ -0,0 +1,4 @@ +name: "Python bytes - Gâcheurs de recette" +identifier: "python-bytes-recipe-wreckers" +type: 'python' +build: true diff --git a/fr-FR/images/banner.png b/fr-FR/images/banner.png new file mode 100644 index 0000000..454465b Binary files /dev/null and b/fr-FR/images/banner.png differ diff --git a/fr-FR/meta.yml b/fr-FR/meta.yml new file mode 100644 index 0000000..91d9b29 --- /dev/null +++ b/fr-FR/meta.yml @@ -0,0 +1,21 @@ +title: Python bytes - Gâcheurs de recette +hero_image: images/banner.png +description: Crée et sabote secrètement une recette en utilisant les méthodes de formatage d'impression et de manipulation de chaînes de caractères Python. +meta_title: Projets de programmation Python pour enfants et adolescent·e·s | Gâcheurs de recette +meta_description: Apprends Python avec la Raspberry Pi Foundation. Crée et sabote secrètement une recette en utilisant print(), les f-strings, les emojis et .replace(). +version: 1 +listed: true +copyedit: false +last_tested: "2025-04-04" +steps: + - title: step_1 + - title: step_2 + completion: + - engaged + - title: step_3 + - title: step_4 + - title: step_5 + - title: step_6 + completion: + - internal + - external diff --git a/fr-FR/resources/mentor.md b/fr-FR/resources/mentor.md new file mode 100644 index 0000000..baa2917 --- /dev/null +++ b/fr-FR/resources/mentor.md @@ -0,0 +1,47 @@ +# Notes pour les mentor·e·s : Gâcheurs de recette + +## Aperçu + +Cette leçon s'appuie sur les bases de `print()` et des f-strings en introduisant : + +- Imprimer le formatage en utilisant `sep=` et `end=` +- Méthodes de casse (`.lower()`) +- Techniques de farce avec `.replace()` +- Amélioration visuelle avec les emojis + +Les apprenant·e·s prennent une recette existante et la transforment progressivement en quelque chose de plus facile à lire, puis la sabotent secrètement pour s'amuser. + +--- + +## Ce qu'ils vont apprendre + +- Comment scinder les longues lignes de code pour une meilleure lisibilité +- Comment utiliser `sep='\n'` pour ajouter des sauts de ligne +- Comment insérer des emojis sous forme de puces +- Comment utiliser `.lower()` pour la mise en forme +- Comment utiliser `.replace()` pour des farces créatives + +--- + +## Conseils + +- Encouragez l'expérimentation avec les emojis +- Les apprenant·e·s doivent exécuter le code avant et après chaque étape pour en comprendre l'impact +- Il est important de préciser que `.replace()` ne modifie pas la chaîne d'origine ; elle en renvoie une nouvelle + +--- + +## Défis + +- Assurez un placement correct de `sep=`, en particulier lorsque vous utilisez des emojis + une nouvelle ligne +- Utilisez `.replace()` de manière sûre sans altérer les chaînes de caractères +- Gérez de manière cohérente les noms de variables entre les tâches + +--- + +## Idées d'extension + +- Demandez aux apprenant·e·s d'écrire leur propre recette et de la saboter +- Introduisez `.count()` ou `.find()` pour inspecter le contenu de la chaîne de caractères +- Créez un menu de farce à deux options utilisant des conditions (si vous êtes prêt) + diff --git a/fr-FR/solutions/main.py b/fr-FR/solutions/main.py new file mode 100644 index 0000000..ffe8c51 --- /dev/null +++ b/fr-FR/solutions/main.py @@ -0,0 +1,17 @@ +emoji = '🍽️😋'.replace('😋', '🤢') + +proteine = 'TOFU'.replace('FU', 'RTUE') # ➝ TORTUE +legume_1 = 'CAROTTE'.replace('CAR', 'B') # ➝ BOTTE +glucide = 'RIZ'.replace('RIZ, 'AT') # ➝ RAT +legume_2 = 'POIS' +garniture = 'MENTHE' +accompagnement = 'ŒUFS CUITS DUR' + +print( + f'{emoji} Commencez par une dose de {glucide.lower()}', + f'Recouvrez par des dés de {legume_1.lower()} et {legume_2.lower()}', + f'Ajoutez des {protéine.title()} grillées', + f'Garnissez avec {garniture.lower()}', + f'Servez avec un accompagnement de {accompagnement.lower()}', + sep='\n' +) diff --git a/fr-FR/step_1.md b/fr-FR/step_1.md new file mode 100644 index 0000000..804a83d --- /dev/null +++ b/fr-FR/step_1.md @@ -0,0 +1,50 @@ +

Faciliter la lecture du code

+ +\--- task --- + +Divise la longue instruction d'impression en plusieurs lignes pour la rendre plus facile à comprendre. + +\--- /task --- + +

Un code lisible est un bon code

+ +Le gérant d'un café a écrit toutes les parties imprimables de la recette sur une seule longue ligne — ça fonctionne, mais c'est difficile à lire ! + +Heureusement, Python te permet d'écrire de longues instructions `print()` sur plusieurs lignes. +Il te suffit de **terminer chaque partie avec une virgule**, et Python la traitera toujours comme une seule commande. + +--- + +**Exécute le programme une fois** avant de faire des changements et regarde la sortie. +Ensuite, divise l'instruction d'impression sur plusieurs lignes et exécute-la à nouveau. +Le résultat devrait être le même, mais le code est beaucoup plus facile à lire ! + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: +--- + +print( +f'Commencez par une dose de {glucide}', +f'Recouvrez de dés de {legume_1} et de {legume_2}', +f'Ajoutez des {proteine} grillées', +f'Garnisez avec {garniture}', +f'Servez avec un accompagnement de {accompagnement}' +) + +\--- /code --- + +
+ +
+ +### Astuce + +Assure-toi de laisser **des virgules** à la fin de chaque ligne dans la déclaration d'impression ! + +
diff --git a/fr-FR/step_2.md b/fr-FR/step_2.md new file mode 100644 index 0000000..b15354c --- /dev/null +++ b/fr-FR/step_2.md @@ -0,0 +1,50 @@ +

Corriger le format de sortie

+ +\--- task --- + +Utilise `sep='\n'` pour imprimer chaque partie de la recette sur sa propre ligne. + +\--- /task --- + +

Diviser la sortie en lignes

+ +Pour l'instant, toutes les lignes des recettes semblent compressées les unes contre les autres. +Tu peux utiliser l'option `sep=` dans `print()` pour dire à Python ce qu'il faut mettre **entre** chaque élément. + +En définissant \`sep='\n', tu obtiendras une **nouvelle ligne** entre chaque partie de l'impression. + +Voici à quoi ton code devrait ressembler : + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 17 +--- + +print( +f'Commencez par une dose de {glucide}', +f'Recouvrez de dés de {legume_1} et de {legume_2}', +f'Ajoutez des {proteine} grillées', +f'Garnisez avec {garniture}', +f'Servez avec un accompagnement de {accompagnement}'), +sep='\n' +) + +\--- /code --- + +
+ +
+ +### Débogage + +Si ta recette tient toujours sur une seule ligne, vérifie : + +- As-tu ajouté `sep='\n'` à la fin du `print()` ? +- Les virgules sont-elles bien placées après chaque ligne ? + +
diff --git a/fr-FR/step_3.md b/fr-FR/step_3.md new file mode 100644 index 0000000..ba255ff --- /dev/null +++ b/fr-FR/step_3.md @@ -0,0 +1,49 @@ +

Ajouter des puces emoji

+ +\--- task --- + +Utilise la variable emoji pour ajouter une puce à chaque ligne. + +\--- /task --- + +

Embellir ta liste

+ +Maintenant que les lignes sont séparées, ajoutons quelques puces ! + +Tu peux le faire en changeant à nouveau le séparateur, cette fois en `sep='\n' + emoji`. + +De plus, tu devras ajouter manuellement l'emoji au **début de la première ligne**, car `sep` ne l'ajoute qu'_entre_ les lignes. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 12, 17 +--- + +print( +f'{emoji}Commencez par une dose de {glucide}', +f'Recouvrez de dés de {legume_1} et de {legume_2}', +f'Ajoutez des {proteine} grillées', +f'Garnisez avec {garniture}', +f'Servez avec un accompagnement de {accompagnement}'), +sep='\n + emoji' +) + +\--- /code --- + +
+ +
+ +### Astuce + +Essaie de changer la variable `emoji` en haut par quelque chose de mignon comme :
+• 🍽️😋
+• 🧁
+• 🍱 + +
diff --git a/fr-FR/step_4.md b/fr-FR/step_4.md new file mode 100644 index 0000000..857689c --- /dev/null +++ b/fr-FR/step_4.md @@ -0,0 +1,40 @@ +

Corriger le formatage des ingrédients

+ +\--- task --- + +Utilise `.title()` et `.lower()` sur les valeurs des ingrédients à l'intérieur de la ligne `print()`. + +\--- /task --- + +

Rendre les ingrédients lisibles

+ +Les ingrédients sont écrits tout en majuscules — rendons-les plus lisibles dans la recette finale. + +- Utilise `.lower()` pour mettre toutes les lettres en minuscules + +Mets à jour chaque ligne `print()`. Deux lignes ont été faites pour toi ci-dessous. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 14 +line_highlights: +--- + +f'Ajoutez des {proteine.lower()} grillées' +f'Garnisez avec {accompagnement.lower()}' + +\--- /code --- + +
+ +
+ +### Débogage + +Assure-toi que tes parenthèses et accolades correspondent correctement lorsque tu appelles `.lower()` à l'intérieur d'une chaîne. + +
diff --git a/fr-FR/step_5.md b/fr-FR/step_5.md new file mode 100644 index 0000000..b671b42 --- /dev/null +++ b/fr-FR/step_5.md @@ -0,0 +1,43 @@ +

Sabotage de la recette avec la fonction .replace()

+ +\--- task --- + +Utilise `.replace()` pour remplacer secrètement les ingrédients par des ingrédients dégoûtants ! + +\--- /task --- + +

Que la farce commence

+ +Maintenant que ta recette est magnifique… il est temps de tout gâcher 😂 + +Utilise `.replace()` pour modifier discrètement les valeurs de tes variables **en haut** de ton code. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 2 +line_highlights: +--- + +proteine = 'TOFU'.replace('FU', 'RTUE') # ➝ TORTUE +veg_1 = 'CAROTTE'.replace('CAR', 'B') # ➝ BOTTE + +\--- /code --- + +
+ +
+ +### Astuce + +Voici plus d'idées : + +- POIS ➝ PUCES +- RIZ ➝ RAT +- ŒUFS CUIT DUR ➝ ŒUFS AVARIÉS +- MENTHE ➝ MENHIR + +
diff --git a/fr-FR/step_6.md b/fr-FR/step_6.md new file mode 100644 index 0000000..3f43f67 --- /dev/null +++ b/fr-FR/step_6.md @@ -0,0 +1,60 @@ +

Remplacer les emojis pour le fun (ou l'horreur)

+ +\--- task --- + +Utilise `.replace()` sur la variable emoji pour transformer des puces mignonnes en puces effrayantes. + +\--- /task --- + +

Changer d'ambiance avec des emojis

+ +Tes puces emojis ont l'air appétissantes — mais changeons cela ! + +Utilise `.replace()` sur la variable `emoji` pour transformer les symboles joyeux en quelque chose d'horrible. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🍽️😋'.replace('😋', '🤢') # ➝ 🍽️🤢 + +\--- /code --- + +
+ +Ou remplace tout le contenu : + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🪳💀' + +\--- /code --- + +
+ +
+ +### Astuce + +Autres emojis à essayer :
+• 🦗
+• 💩
+• 🧟
+• ☠️
+• 🐛 + +
\ No newline at end of file diff --git a/hi-IN/code/starter/main.py b/hi-IN/code/starter/main.py new file mode 100644 index 0000000..a68ddac --- /dev/null +++ b/hi-IN/code/starter/main.py @@ -0,0 +1,11 @@ +# Ingredients +protein = 'TOFU' +veg_1 = 'CARROT' +veg_2 = 'PEAS' +carb = 'RICE' +side = 'BOILED EGGS' +garnish = 'MINT' +emoji = '🍽️😋' + +# Final recipe print +print(f'Start with a scoop of {carb}',f'Top with diced {veg_1} and {veg_2}',f'Add grilled {protein}',f'Garnish with {garnish}',f'Serve with a side of {side}') \ No newline at end of file diff --git a/hi-IN/code/starter/project_config.yml b/hi-IN/code/starter/project_config.yml new file mode 100644 index 0000000..3d8d40c --- /dev/null +++ b/hi-IN/code/starter/project_config.yml @@ -0,0 +1,4 @@ +name: "Python bytes - Recipe wreckers" +identifier: "python-bytes-recipe-wreckers" +type: 'python' +build: true diff --git a/hi-IN/images/banner.png b/hi-IN/images/banner.png new file mode 100644 index 0000000..454465b Binary files /dev/null and b/hi-IN/images/banner.png differ diff --git a/hi-IN/meta.yml b/hi-IN/meta.yml new file mode 100644 index 0000000..912eb26 --- /dev/null +++ b/hi-IN/meta.yml @@ -0,0 +1,21 @@ +title: Python bytes - Recipe wreckers +hero_image: images/banner.png +description: Create and secretly sabotage a recipe using Python print formatting and string methods. +meta_title: Python coding projects for kids and teens | Recipe Wreckers +meta_description: Learn Python with the Raspberry Pi Foundation. Make and secretly ruin a recipe using print(), f-strings, emoji, and .replace(). +version: 1 +listed: true +copyedit: false +last_tested: "2025-04-04" +steps: + - title: step_1 + - title: step_2 + completion: + - engaged + - title: step_3 + - title: step_4 + - title: step_5 + - title: step_6 + completion: + - internal + - external diff --git a/hi-IN/resources/mentor.md b/hi-IN/resources/mentor.md new file mode 100644 index 0000000..b5d1f85 --- /dev/null +++ b/hi-IN/resources/mentor.md @@ -0,0 +1,47 @@ +# Mentor Notes: Recipe Wreckers + +## Overview + +This lesson builds on the basics of `print()` and f-strings by introducing: + +- Print formatting using `sep=` and `end=` +- String case methods (`.lower()`) +- Pranking techniques with `.replace()` +- Visual enhancement with emoji + +Learners take an existing recipe and gradually transform it into something easier to read, then secretly sabotage it for fun. + +--- + +## What They Will Learn + +- How to split long lines of code for readability +- How to use `sep='\n'` to add line breaks +- How to insert emoji as bullet points +- How to use `.lower()` for styling +- How to use `.replace()` for creative pranks + +--- + +## Tips + +- Encourage experimentation with emoji +- Learners should run code before and after each step to understand the impact +- Reinforce that `.replace()` doesn’t change the original string — it returns a new one + +--- + +## Challenges + +- Ensuring correct placement of `sep=`, especially when using emoji + newline +- Using `.replace()` safely without breaking strings +- Managing variable names consistently between tasks + +--- + +## Extension Ideas + +- Ask learners to write their own recipe and sabotage it +- Introduce `.count()` or `.find()` to inspect string contents +- Create a two-option prank menu using conditionals (if ready) + diff --git a/hi-IN/solutions/main.py b/hi-IN/solutions/main.py new file mode 100644 index 0000000..304a1f6 --- /dev/null +++ b/hi-IN/solutions/main.py @@ -0,0 +1,17 @@ +emoji = '🍽️😋'.replace('😋', '🤢') + +protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD +veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT +carb = 'RICE'.replace('R', 'L') # ➝ LICE +veg_2 = 'PEAS' +garnish = 'MINT' +side = 'BOILED EGGS' + +print( + f'{emoji} Start with a scoop of {carb.lower()}', + f'Top with diced {veg_1.lower()} and {veg_2.lower()}', + f'Add grilled {protein.title()}', + f'Garnish with {garnish.lower()}', + f'Serve with a side of {side.lower()}', + sep='\n' +) diff --git a/hi-IN/step_1.md b/hi-IN/step_1.md new file mode 100644 index 0000000..e94d874 --- /dev/null +++ b/hi-IN/step_1.md @@ -0,0 +1,50 @@ +

Make the code easier to read

+ +\--- task --- + +Split the long print statement onto multiple lines so it’s easier to understand. + +\--- /task --- + +

Readable code is good code

+ +A café manager has written all the recipe print parts on one long line — it works, but it's hard to read! + +Luckily, Python lets you write long `print()` statements across multiple lines. +You just need to **end each part with a comma**, and Python will still treat it as one command. + +--- + +**Run the program once** before making changes and look at the output. +Then split the print statement across multiple lines and run it again. +The output should be the same — but the code is much easier to read! + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: +--- + +print( +f'Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}' +) + +\--- /code --- + +
+ +
+ +### Tip + +Make sure you leave **commas** at the end of each line inside the print statement! + +
diff --git a/hi-IN/step_2.md b/hi-IN/step_2.md new file mode 100644 index 0000000..4f7bf91 --- /dev/null +++ b/hi-IN/step_2.md @@ -0,0 +1,50 @@ +

Fix the output format

+ +\--- task --- + +Use `sep='\n'` to print each part of the recipe on its own line. + +\--- /task --- + +

Split the output into lines

+ +Right now, all the recipe lines appear squashed together. +You can use the `sep=` option in `print()` to tell Python what to put **between** each item. + +By setting `sep='\n'`, you’ll get a **new line** between every part of the print. + +Here’s what your code should look like: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 17 +--- + +print( +f'Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}', +sep='\n' +) + +\--- /code --- + +
+ +
+ +### Debugging + +If your recipe is still on one line, check: + +- Did you add `sep='\n'` at the end of the `print()`? +- Are the commas in place after each line? + +
diff --git a/hi-IN/step_3.md b/hi-IN/step_3.md new file mode 100644 index 0000000..5c9d299 --- /dev/null +++ b/hi-IN/step_3.md @@ -0,0 +1,49 @@ +

Add emoji bullets

+ +\--- task --- + +Use the emoji variable to add a bullet point to every line. + +\--- /task --- + +

Make your list look amazing

+ +Now that the lines are separated, let’s add some bullet points! + +You can do this by changing the separator again, this time to `sep='\n' + emoji`. + +Also, you’ll want to manually add the emoji at the **start of the first line**, since `sep` only adds it _between_ lines. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 12, 17 +--- + +print( +f'{emoji}Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}', +sep='\n' + emoji +) + +\--- /code --- + +
+ +
+ +### Tip + +Try changing the `emoji` variable at the top to something cute like:
+• 🍽️😋
+• 🧁
+• 🍱 + +
diff --git a/hi-IN/step_4.md b/hi-IN/step_4.md new file mode 100644 index 0000000..616168b --- /dev/null +++ b/hi-IN/step_4.md @@ -0,0 +1,40 @@ +

Fix the ingredient formatting

+ +\--- task --- + +Use `.title()` and `.lower()` on the ingredient values inside the `print()` line. + +\--- /task --- + +

Make the ingredients readable

+ +The ingredients are written in all uppercase — let’s make them easier to read in the final recipe. + +- Use `.lower()` to make all the letters lowercase + +Update each of the `print()` lines. Two lines have been done for you below. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 14 +line_highlights: +--- + +f'Add grilled {protein.lower()}' +f'Garnish with {garnish.lower()}' + +\--- /code --- + +
+ +
+ +### Debugging + +Make sure your parentheses and curly braces match correctly when calling `.lower()` inside a string. + +
diff --git a/hi-IN/step_5.md b/hi-IN/step_5.md new file mode 100644 index 0000000..dc10299 --- /dev/null +++ b/hi-IN/step_5.md @@ -0,0 +1,43 @@ +

Sabotage the recipe with .replace()

+ +\--- task --- + +Use `.replace()` to secretly swap ingredients with disgusting ones! + +\--- /task --- + +

Let the prank begin

+ +Now that your recipe looks beautiful… it’s time to ruin it 😂 + +Use `.replace()` to quietly change the values of your variables **at the top** of your code. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 2 +line_highlights: +--- + +protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD +veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT + +\--- /code --- + +
+ +
+ +### Tip + +Here are more ideas: + +- PEAS ➝ FLEAS +- RICE ➝ LICE +- BOILED EGGS ➝ SPOILED EGGS +- MINT ➝ PAINT + +
diff --git a/hi-IN/step_6.md b/hi-IN/step_6.md new file mode 100644 index 0000000..6ccaf1f --- /dev/null +++ b/hi-IN/step_6.md @@ -0,0 +1,60 @@ +

Replace the emoji for fun (or horror)

+ +\--- task --- + +Use `.replace()` on the emoji variable to turn cute bullets into creepy ones. + +\--- /task --- + +

Change the mood with emoji

+ +Your emoji bullets look tasty — but let’s change that! + +Use `.replace()` on the `emoji` variable to turn happy symbols into something horrible. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🍽️😋'.replace('😋', '🤢') # ➝ 🍽️🤢 + +\--- /code --- + +
+ +Or replace the whole thing completely: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🪳💀' + +\--- /code --- + +
+ +
+ +### Tip + +Other emoji options to try:
+• 🦗
+• 💩
+• 🧟
+• ☠️
+• 🐛 + +
\ No newline at end of file diff --git a/it-IT/code/starter/main.py b/it-IT/code/starter/main.py new file mode 100644 index 0000000..a68ddac --- /dev/null +++ b/it-IT/code/starter/main.py @@ -0,0 +1,11 @@ +# Ingredients +protein = 'TOFU' +veg_1 = 'CARROT' +veg_2 = 'PEAS' +carb = 'RICE' +side = 'BOILED EGGS' +garnish = 'MINT' +emoji = '🍽️😋' + +# Final recipe print +print(f'Start with a scoop of {carb}',f'Top with diced {veg_1} and {veg_2}',f'Add grilled {protein}',f'Garnish with {garnish}',f'Serve with a side of {side}') \ No newline at end of file diff --git a/it-IT/code/starter/project_config.yml b/it-IT/code/starter/project_config.yml new file mode 100644 index 0000000..3d8d40c --- /dev/null +++ b/it-IT/code/starter/project_config.yml @@ -0,0 +1,4 @@ +name: "Python bytes - Recipe wreckers" +identifier: "python-bytes-recipe-wreckers" +type: 'python' +build: true diff --git a/it-IT/images/banner.png b/it-IT/images/banner.png new file mode 100644 index 0000000..454465b Binary files /dev/null and b/it-IT/images/banner.png differ diff --git a/it-IT/meta.yml b/it-IT/meta.yml new file mode 100644 index 0000000..912eb26 --- /dev/null +++ b/it-IT/meta.yml @@ -0,0 +1,21 @@ +title: Python bytes - Recipe wreckers +hero_image: images/banner.png +description: Create and secretly sabotage a recipe using Python print formatting and string methods. +meta_title: Python coding projects for kids and teens | Recipe Wreckers +meta_description: Learn Python with the Raspberry Pi Foundation. Make and secretly ruin a recipe using print(), f-strings, emoji, and .replace(). +version: 1 +listed: true +copyedit: false +last_tested: "2025-04-04" +steps: + - title: step_1 + - title: step_2 + completion: + - engaged + - title: step_3 + - title: step_4 + - title: step_5 + - title: step_6 + completion: + - internal + - external diff --git a/it-IT/resources/mentor.md b/it-IT/resources/mentor.md new file mode 100644 index 0000000..b5d1f85 --- /dev/null +++ b/it-IT/resources/mentor.md @@ -0,0 +1,47 @@ +# Mentor Notes: Recipe Wreckers + +## Overview + +This lesson builds on the basics of `print()` and f-strings by introducing: + +- Print formatting using `sep=` and `end=` +- String case methods (`.lower()`) +- Pranking techniques with `.replace()` +- Visual enhancement with emoji + +Learners take an existing recipe and gradually transform it into something easier to read, then secretly sabotage it for fun. + +--- + +## What They Will Learn + +- How to split long lines of code for readability +- How to use `sep='\n'` to add line breaks +- How to insert emoji as bullet points +- How to use `.lower()` for styling +- How to use `.replace()` for creative pranks + +--- + +## Tips + +- Encourage experimentation with emoji +- Learners should run code before and after each step to understand the impact +- Reinforce that `.replace()` doesn’t change the original string — it returns a new one + +--- + +## Challenges + +- Ensuring correct placement of `sep=`, especially when using emoji + newline +- Using `.replace()` safely without breaking strings +- Managing variable names consistently between tasks + +--- + +## Extension Ideas + +- Ask learners to write their own recipe and sabotage it +- Introduce `.count()` or `.find()` to inspect string contents +- Create a two-option prank menu using conditionals (if ready) + diff --git a/it-IT/solutions/main.py b/it-IT/solutions/main.py new file mode 100644 index 0000000..304a1f6 --- /dev/null +++ b/it-IT/solutions/main.py @@ -0,0 +1,17 @@ +emoji = '🍽️😋'.replace('😋', '🤢') + +protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD +veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT +carb = 'RICE'.replace('R', 'L') # ➝ LICE +veg_2 = 'PEAS' +garnish = 'MINT' +side = 'BOILED EGGS' + +print( + f'{emoji} Start with a scoop of {carb.lower()}', + f'Top with diced {veg_1.lower()} and {veg_2.lower()}', + f'Add grilled {protein.title()}', + f'Garnish with {garnish.lower()}', + f'Serve with a side of {side.lower()}', + sep='\n' +) diff --git a/it-IT/step_1.md b/it-IT/step_1.md new file mode 100644 index 0000000..e94d874 --- /dev/null +++ b/it-IT/step_1.md @@ -0,0 +1,50 @@ +

Make the code easier to read

+ +\--- task --- + +Split the long print statement onto multiple lines so it’s easier to understand. + +\--- /task --- + +

Readable code is good code

+ +A café manager has written all the recipe print parts on one long line — it works, but it's hard to read! + +Luckily, Python lets you write long `print()` statements across multiple lines. +You just need to **end each part with a comma**, and Python will still treat it as one command. + +--- + +**Run the program once** before making changes and look at the output. +Then split the print statement across multiple lines and run it again. +The output should be the same — but the code is much easier to read! + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: +--- + +print( +f'Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}' +) + +\--- /code --- + +
+ +
+ +### Tip + +Make sure you leave **commas** at the end of each line inside the print statement! + +
diff --git a/it-IT/step_2.md b/it-IT/step_2.md new file mode 100644 index 0000000..4f7bf91 --- /dev/null +++ b/it-IT/step_2.md @@ -0,0 +1,50 @@ +

Fix the output format

+ +\--- task --- + +Use `sep='\n'` to print each part of the recipe on its own line. + +\--- /task --- + +

Split the output into lines

+ +Right now, all the recipe lines appear squashed together. +You can use the `sep=` option in `print()` to tell Python what to put **between** each item. + +By setting `sep='\n'`, you’ll get a **new line** between every part of the print. + +Here’s what your code should look like: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 17 +--- + +print( +f'Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}', +sep='\n' +) + +\--- /code --- + +
+ +
+ +### Debugging + +If your recipe is still on one line, check: + +- Did you add `sep='\n'` at the end of the `print()`? +- Are the commas in place after each line? + +
diff --git a/it-IT/step_3.md b/it-IT/step_3.md new file mode 100644 index 0000000..5c9d299 --- /dev/null +++ b/it-IT/step_3.md @@ -0,0 +1,49 @@ +

Add emoji bullets

+ +\--- task --- + +Use the emoji variable to add a bullet point to every line. + +\--- /task --- + +

Make your list look amazing

+ +Now that the lines are separated, let’s add some bullet points! + +You can do this by changing the separator again, this time to `sep='\n' + emoji`. + +Also, you’ll want to manually add the emoji at the **start of the first line**, since `sep` only adds it _between_ lines. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 12, 17 +--- + +print( +f'{emoji}Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}', +sep='\n' + emoji +) + +\--- /code --- + +
+ +
+ +### Tip + +Try changing the `emoji` variable at the top to something cute like:
+• 🍽️😋
+• 🧁
+• 🍱 + +
diff --git a/it-IT/step_4.md b/it-IT/step_4.md new file mode 100644 index 0000000..616168b --- /dev/null +++ b/it-IT/step_4.md @@ -0,0 +1,40 @@ +

Fix the ingredient formatting

+ +\--- task --- + +Use `.title()` and `.lower()` on the ingredient values inside the `print()` line. + +\--- /task --- + +

Make the ingredients readable

+ +The ingredients are written in all uppercase — let’s make them easier to read in the final recipe. + +- Use `.lower()` to make all the letters lowercase + +Update each of the `print()` lines. Two lines have been done for you below. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 14 +line_highlights: +--- + +f'Add grilled {protein.lower()}' +f'Garnish with {garnish.lower()}' + +\--- /code --- + +
+ +
+ +### Debugging + +Make sure your parentheses and curly braces match correctly when calling `.lower()` inside a string. + +
diff --git a/it-IT/step_5.md b/it-IT/step_5.md new file mode 100644 index 0000000..dc10299 --- /dev/null +++ b/it-IT/step_5.md @@ -0,0 +1,43 @@ +

Sabotage the recipe with .replace()

+ +\--- task --- + +Use `.replace()` to secretly swap ingredients with disgusting ones! + +\--- /task --- + +

Let the prank begin

+ +Now that your recipe looks beautiful… it’s time to ruin it 😂 + +Use `.replace()` to quietly change the values of your variables **at the top** of your code. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 2 +line_highlights: +--- + +protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD +veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT + +\--- /code --- + +
+ +
+ +### Tip + +Here are more ideas: + +- PEAS ➝ FLEAS +- RICE ➝ LICE +- BOILED EGGS ➝ SPOILED EGGS +- MINT ➝ PAINT + +
diff --git a/it-IT/step_6.md b/it-IT/step_6.md new file mode 100644 index 0000000..6ccaf1f --- /dev/null +++ b/it-IT/step_6.md @@ -0,0 +1,60 @@ +

Replace the emoji for fun (or horror)

+ +\--- task --- + +Use `.replace()` on the emoji variable to turn cute bullets into creepy ones. + +\--- /task --- + +

Change the mood with emoji

+ +Your emoji bullets look tasty — but let’s change that! + +Use `.replace()` on the `emoji` variable to turn happy symbols into something horrible. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🍽️😋'.replace('😋', '🤢') # ➝ 🍽️🤢 + +\--- /code --- + +
+ +Or replace the whole thing completely: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🪳💀' + +\--- /code --- + +
+ +
+ +### Tip + +Other emoji options to try:
+• 🦗
+• 💩
+• 🧟
+• ☠️
+• 🐛 + +
\ No newline at end of file diff --git a/ja-JP/code/starter/main.py b/ja-JP/code/starter/main.py new file mode 100644 index 0000000..a68ddac --- /dev/null +++ b/ja-JP/code/starter/main.py @@ -0,0 +1,11 @@ +# Ingredients +protein = 'TOFU' +veg_1 = 'CARROT' +veg_2 = 'PEAS' +carb = 'RICE' +side = 'BOILED EGGS' +garnish = 'MINT' +emoji = '🍽️😋' + +# Final recipe print +print(f'Start with a scoop of {carb}',f'Top with diced {veg_1} and {veg_2}',f'Add grilled {protein}',f'Garnish with {garnish}',f'Serve with a side of {side}') \ No newline at end of file diff --git a/ja-JP/code/starter/project_config.yml b/ja-JP/code/starter/project_config.yml new file mode 100644 index 0000000..3d8d40c --- /dev/null +++ b/ja-JP/code/starter/project_config.yml @@ -0,0 +1,4 @@ +name: "Python bytes - Recipe wreckers" +identifier: "python-bytes-recipe-wreckers" +type: 'python' +build: true diff --git a/ja-JP/images/banner.png b/ja-JP/images/banner.png new file mode 100644 index 0000000..454465b Binary files /dev/null and b/ja-JP/images/banner.png differ diff --git a/ja-JP/meta.yml b/ja-JP/meta.yml new file mode 100644 index 0000000..912eb26 --- /dev/null +++ b/ja-JP/meta.yml @@ -0,0 +1,21 @@ +title: Python bytes - Recipe wreckers +hero_image: images/banner.png +description: Create and secretly sabotage a recipe using Python print formatting and string methods. +meta_title: Python coding projects for kids and teens | Recipe Wreckers +meta_description: Learn Python with the Raspberry Pi Foundation. Make and secretly ruin a recipe using print(), f-strings, emoji, and .replace(). +version: 1 +listed: true +copyedit: false +last_tested: "2025-04-04" +steps: + - title: step_1 + - title: step_2 + completion: + - engaged + - title: step_3 + - title: step_4 + - title: step_5 + - title: step_6 + completion: + - internal + - external diff --git a/ja-JP/resources/mentor.md b/ja-JP/resources/mentor.md new file mode 100644 index 0000000..b5d1f85 --- /dev/null +++ b/ja-JP/resources/mentor.md @@ -0,0 +1,47 @@ +# Mentor Notes: Recipe Wreckers + +## Overview + +This lesson builds on the basics of `print()` and f-strings by introducing: + +- Print formatting using `sep=` and `end=` +- String case methods (`.lower()`) +- Pranking techniques with `.replace()` +- Visual enhancement with emoji + +Learners take an existing recipe and gradually transform it into something easier to read, then secretly sabotage it for fun. + +--- + +## What They Will Learn + +- How to split long lines of code for readability +- How to use `sep='\n'` to add line breaks +- How to insert emoji as bullet points +- How to use `.lower()` for styling +- How to use `.replace()` for creative pranks + +--- + +## Tips + +- Encourage experimentation with emoji +- Learners should run code before and after each step to understand the impact +- Reinforce that `.replace()` doesn’t change the original string — it returns a new one + +--- + +## Challenges + +- Ensuring correct placement of `sep=`, especially when using emoji + newline +- Using `.replace()` safely without breaking strings +- Managing variable names consistently between tasks + +--- + +## Extension Ideas + +- Ask learners to write their own recipe and sabotage it +- Introduce `.count()` or `.find()` to inspect string contents +- Create a two-option prank menu using conditionals (if ready) + diff --git a/ja-JP/solutions/main.py b/ja-JP/solutions/main.py new file mode 100644 index 0000000..304a1f6 --- /dev/null +++ b/ja-JP/solutions/main.py @@ -0,0 +1,17 @@ +emoji = '🍽️😋'.replace('😋', '🤢') + +protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD +veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT +carb = 'RICE'.replace('R', 'L') # ➝ LICE +veg_2 = 'PEAS' +garnish = 'MINT' +side = 'BOILED EGGS' + +print( + f'{emoji} Start with a scoop of {carb.lower()}', + f'Top with diced {veg_1.lower()} and {veg_2.lower()}', + f'Add grilled {protein.title()}', + f'Garnish with {garnish.lower()}', + f'Serve with a side of {side.lower()}', + sep='\n' +) diff --git a/ja-JP/step_1.md b/ja-JP/step_1.md new file mode 100644 index 0000000..e94d874 --- /dev/null +++ b/ja-JP/step_1.md @@ -0,0 +1,50 @@ +

Make the code easier to read

+ +\--- task --- + +Split the long print statement onto multiple lines so it’s easier to understand. + +\--- /task --- + +

Readable code is good code

+ +A café manager has written all the recipe print parts on one long line — it works, but it's hard to read! + +Luckily, Python lets you write long `print()` statements across multiple lines. +You just need to **end each part with a comma**, and Python will still treat it as one command. + +--- + +**Run the program once** before making changes and look at the output. +Then split the print statement across multiple lines and run it again. +The output should be the same — but the code is much easier to read! + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: +--- + +print( +f'Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}' +) + +\--- /code --- + +
+ +
+ +### Tip + +Make sure you leave **commas** at the end of each line inside the print statement! + +
diff --git a/ja-JP/step_2.md b/ja-JP/step_2.md new file mode 100644 index 0000000..4f7bf91 --- /dev/null +++ b/ja-JP/step_2.md @@ -0,0 +1,50 @@ +

Fix the output format

+ +\--- task --- + +Use `sep='\n'` to print each part of the recipe on its own line. + +\--- /task --- + +

Split the output into lines

+ +Right now, all the recipe lines appear squashed together. +You can use the `sep=` option in `print()` to tell Python what to put **between** each item. + +By setting `sep='\n'`, you’ll get a **new line** between every part of the print. + +Here’s what your code should look like: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 17 +--- + +print( +f'Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}', +sep='\n' +) + +\--- /code --- + +
+ +
+ +### Debugging + +If your recipe is still on one line, check: + +- Did you add `sep='\n'` at the end of the `print()`? +- Are the commas in place after each line? + +
diff --git a/ja-JP/step_3.md b/ja-JP/step_3.md new file mode 100644 index 0000000..5c9d299 --- /dev/null +++ b/ja-JP/step_3.md @@ -0,0 +1,49 @@ +

Add emoji bullets

+ +\--- task --- + +Use the emoji variable to add a bullet point to every line. + +\--- /task --- + +

Make your list look amazing

+ +Now that the lines are separated, let’s add some bullet points! + +You can do this by changing the separator again, this time to `sep='\n' + emoji`. + +Also, you’ll want to manually add the emoji at the **start of the first line**, since `sep` only adds it _between_ lines. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 12, 17 +--- + +print( +f'{emoji}Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}', +sep='\n' + emoji +) + +\--- /code --- + +
+ +
+ +### Tip + +Try changing the `emoji` variable at the top to something cute like:
+• 🍽️😋
+• 🧁
+• 🍱 + +
diff --git a/ja-JP/step_4.md b/ja-JP/step_4.md new file mode 100644 index 0000000..616168b --- /dev/null +++ b/ja-JP/step_4.md @@ -0,0 +1,40 @@ +

Fix the ingredient formatting

+ +\--- task --- + +Use `.title()` and `.lower()` on the ingredient values inside the `print()` line. + +\--- /task --- + +

Make the ingredients readable

+ +The ingredients are written in all uppercase — let’s make them easier to read in the final recipe. + +- Use `.lower()` to make all the letters lowercase + +Update each of the `print()` lines. Two lines have been done for you below. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 14 +line_highlights: +--- + +f'Add grilled {protein.lower()}' +f'Garnish with {garnish.lower()}' + +\--- /code --- + +
+ +
+ +### Debugging + +Make sure your parentheses and curly braces match correctly when calling `.lower()` inside a string. + +
diff --git a/ja-JP/step_5.md b/ja-JP/step_5.md new file mode 100644 index 0000000..dc10299 --- /dev/null +++ b/ja-JP/step_5.md @@ -0,0 +1,43 @@ +

Sabotage the recipe with .replace()

+ +\--- task --- + +Use `.replace()` to secretly swap ingredients with disgusting ones! + +\--- /task --- + +

Let the prank begin

+ +Now that your recipe looks beautiful… it’s time to ruin it 😂 + +Use `.replace()` to quietly change the values of your variables **at the top** of your code. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 2 +line_highlights: +--- + +protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD +veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT + +\--- /code --- + +
+ +
+ +### Tip + +Here are more ideas: + +- PEAS ➝ FLEAS +- RICE ➝ LICE +- BOILED EGGS ➝ SPOILED EGGS +- MINT ➝ PAINT + +
diff --git a/ja-JP/step_6.md b/ja-JP/step_6.md new file mode 100644 index 0000000..6ccaf1f --- /dev/null +++ b/ja-JP/step_6.md @@ -0,0 +1,60 @@ +

Replace the emoji for fun (or horror)

+ +\--- task --- + +Use `.replace()` on the emoji variable to turn cute bullets into creepy ones. + +\--- /task --- + +

Change the mood with emoji

+ +Your emoji bullets look tasty — but let’s change that! + +Use `.replace()` on the `emoji` variable to turn happy symbols into something horrible. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🍽️😋'.replace('😋', '🤢') # ➝ 🍽️🤢 + +\--- /code --- + +
+ +Or replace the whole thing completely: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🪳💀' + +\--- /code --- + +
+ +
+ +### Tip + +Other emoji options to try:
+• 🦗
+• 💩
+• 🧟
+• ☠️
+• 🐛 + +
\ No newline at end of file diff --git a/nl-NL/code/starter/main.py b/nl-NL/code/starter/main.py new file mode 100644 index 0000000..39b0eaa --- /dev/null +++ b/nl-NL/code/starter/main.py @@ -0,0 +1,11 @@ +# Ingrediënten +eiwitten = 'TOFU' +groente_1 = 'WORTEL' +groente_2 = 'ERWTEN' +koolhydraten = 'RIJST' +bijgerecht = 'GEKOOKTE EIEREN' +garnering = 'MUNT' +emoji = '🍽️😋' + +# Definitieve receptafdruk +print(f'Begin met een schepje {kookhydraten}',f'Bedek met in blokjes gesneden {groente_1} en {groente_2}',f'Voeg gegrilde {eiwitten} toe ',f'Garneer met {garnering}',f'Serveer met een bijgerecht van {bijgerecht}') \ No newline at end of file diff --git a/nl-NL/code/starter/project_config.yml b/nl-NL/code/starter/project_config.yml new file mode 100644 index 0000000..105351b --- /dev/null +++ b/nl-NL/code/starter/project_config.yml @@ -0,0 +1,4 @@ +name: "Python-bytes - Receptverpesters" +identifier: "python-bytes-recipe-wreckers" +type: 'python' +build: true diff --git a/nl-NL/images/banner.png b/nl-NL/images/banner.png new file mode 100644 index 0000000..454465b Binary files /dev/null and b/nl-NL/images/banner.png differ diff --git a/nl-NL/meta.yml b/nl-NL/meta.yml new file mode 100644 index 0000000..f821447 --- /dev/null +++ b/nl-NL/meta.yml @@ -0,0 +1,21 @@ +title: Python-bytes - Receptverpesters +hero_image: images/banner.png +description: Maak en saboteer stiekem een recept met behulp van Python-opmaakfuncties en tekenreeksmethoden. +meta_title: Python-programmeerprojecten voor kinderen en tieners | Receptverpesters +meta_description: Leer Python met de Raspberry Pi Foundation. Maak en verpest stiekem een recept met behulp van print(), f-strings, emoji en .replace(). +version: 1 +listed: true +copyedit: false +last_tested: "2025-04-04" +steps: + - title: step_1 + - title: step_2 + completion: + - engaged + - title: step_3 + - title: step_4 + - title: step_5 + - title: step_6 + completion: + - internal + - external diff --git a/nl-NL/resources/mentor.md b/nl-NL/resources/mentor.md new file mode 100644 index 0000000..835ee38 --- /dev/null +++ b/nl-NL/resources/mentor.md @@ -0,0 +1,47 @@ +# Mentornotities: Receptverpesters + +## Overzicht + +Deze les bouwt voort op de basisprincipes van `print()` en f-strings door het volgende te introduceren: + +- Printopmaak met `sep=` en `end=` +- Tekenreeksmethoden (`.lower()`) +- Technieken om grappen uit te halen met `.replace()` +- Visuele verbetering met emoji + +Leerlingen nemen een bestaand recept en transformeren het geleidelijk tot iets dat makkelijker te lezen is, om het vervolgens stiekem voor de lol te saboteren. + +--- + +## Wat gaan ze leren + +- Hoe lange regels code op te splitsen voor betere leesbaarheid +- Hoe gebruik je `sep='\n'` om regeleinden toe te voegen +- Hoe voeg je emoji's in als opsommingstekens +- Hoe gebruik je `.lower()` voor styling +- Hoe gebruik je `.replace()` voor creatieve grappen + +--- + +## Tips + +- Stimuleer het experimenteren met emoji's +- Leerlingen moeten de code vóór en na elke stap uitvoeren om de impact te begrijpen +- Benadruk dat `.replace()` de oorspronkelijke tekenreeks niet wijzigt, maar een nieuwe tekenreeks retourneert + +--- + +## Uitdagingen + +- Zorg voor de juiste plaatsing van `sep=`, vooral bij gebruik van emoji + nieuwe regel +- Veilig gebruikmaken van `.replace()` zonder tekenreeksen te beschadigen +- Variabelennamen consistent beheren tussen taken + +--- + +## Uitbreidingsideeën + +- Vraag de leerlingen om hun eigen recept te schrijven en het vervolgens te saboteren +- Introduceer `.count()` of `.find()` om de inhoud van een tekenreeks te inspecteren +- Maak een grapmenu met twee opties met behulp van voorwaarden (indien beschikbaar) + diff --git a/nl-NL/solutions/main.py b/nl-NL/solutions/main.py new file mode 100644 index 0000000..84b4c4e --- /dev/null +++ b/nl-NL/solutions/main.py @@ -0,0 +1,17 @@ +emoji = '🍽️😋'.replace('😋', '🤢') + +eiwitten = 'TOFU'.replace('FU', 'NG') # ➝ TONG +groente_1 = 'WORTEL'.replace('RTE', '') # ➝ WOL +koolhydraten = 'RIJST'.replace('IJ', OE') # ➝ ROEST +groente_2 = 'ERWTEN' +garnering = 'MUNT' +bijgerecht = 'GEKOOKTE EIEREN' + +print( + f'{emoji} Begin met een schepje {koolhydraten.lower()}', + f'Bedek met in blokjes gesneden {groente_1.lower()} en {groente_2.lower()}', + f'Voeg gegrilde {eiwitten.title()} toe', + f'Garneer met {garnering.lower()}', + f'Serveer met een bijgerecht van {bijgerecht.lower()}', + sep='\n' +) diff --git a/nl-NL/step_1.md b/nl-NL/step_1.md new file mode 100644 index 0000000..565bff2 --- /dev/null +++ b/nl-NL/step_1.md @@ -0,0 +1,50 @@ +

Maak de code gemakkelijker te lezen

+ +\--- task --- + +Splits de lange printopdracht op in meerdere regels, zodat deze beter te begrijpen is. + +\--- /task --- + +

Leesbare code is goede code

+ +Een cafémanager heeft alle onderdelen van het recept op één lange regel geschreven — het werkt, maar het is moeilijk leesbaar! + +Gelukkig kun je in Python lange `print()`-instructies over meerdere regels schrijven. +Je hoeft alleen maar **elk onderdeel met een komma af te sluiten**, en Python zal het nog steeds als één commando beschouwen. + +--- + +**Voer het programma eerst een keer uit** voordat je wijzigingen aanbrengt en bekijk de uitvoer. +Splits vervolgens de printopdracht over meerdere regels en voer deze opnieuw uit. +De uitvoer zou hetzelfde moeten zijn, maar de code is veel gemakkelijker te lezen! + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: +--- + +print( +f'Begin met een schepje {koolhydraten}', +f'Bedek met in blokjes gesneden {groente_1} and {groente_2}', +f'Voeg gegrilde {eiwitten} toe', +f'Garneer met {garnering}', +f'Serveer met een bijgerecht van {bijgerecht}' +) + +\--- /code --- + +
+ +
+ +### Tip + +Zorg ervoor dat je aan het einde van elke regel in de printopdracht **komma's** laat staan! + +
diff --git a/nl-NL/step_2.md b/nl-NL/step_2.md new file mode 100644 index 0000000..b9631e5 --- /dev/null +++ b/nl-NL/step_2.md @@ -0,0 +1,50 @@ +

Corrigeer het uitvoerformaat

+ +\--- task --- + +Gebruik `sep='\n'` om elk onderdeel van het recept op een aparte regel af te drukken. + +\--- /task --- + +

Splits de uitvoer in regels

+ +Op dit moment lijken alle receptregels dicht op elkaar te staan. +Je kunt de `sep=` optie in `print()` gebruiken om Python te vertellen wat er **tussen** elk item moet komen. + +Door `sep='\n'` in te stellen, krijg je een **nieuwe regel** tussen elk onderdeel van de afdruk. + +Dit is hoe je code eruit zou moeten zien: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 17 +--- + +print( +f'Begin met een schepje {koolhydraten}', +f'Bedek met in blokjes gesneden {groente_1} and {groente_2}', +f'Voeg gegrilde {eiwitten} toe', +f'Garneer met {garnering}', +f'Serveer met een bijgerecht van {bijgerecht}', +sep='\n' +) + +\--- /code --- + +
+ +
+ +### Foutopsporing + +Als je recept nog steeds op één regel staat, controleer dan het volgende: + +- Heb je `sep='\n'` aan het einde van de `print()` toegevoegd? +- Staan de komma's na elke regel op de juiste plaats? + +
diff --git a/nl-NL/step_3.md b/nl-NL/step_3.md new file mode 100644 index 0000000..22e2a08 --- /dev/null +++ b/nl-NL/step_3.md @@ -0,0 +1,49 @@ +

Voeg emoji-opsommingstekens toe

+ +\--- task --- + +Gebruik de emoji-variabele om aan elke regel een opsommingsteken toe te voegen. + +\--- /task --- + +

Zorg dat je lijst er fantastisch uitziet

+ +Nu de regels gescheiden zijn, voegen we er wat opsommingstekens aan toe! + +Je kunt dit doen door het scheidingsteken opnieuw te wijzigen, ditmaal naar `sep='\n' + emoji`. + +Daarnaast is het aan te raden de emoji handmatig toe te voegen aan het **begin van de eerste regel**, aangezien `sep` deze alleen _tussen_ regels plaatst. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 12, 17 +--- + +print( +f'{emoji}Begin met een schepje {koolhydraten}', +f'Bedek met in blokjes gesneden {groente_1} and {groente_2}', +f'Voeg gegrilde {eiwitten} toe', +f'Garneer met {garnering}', +f'Serveer met een bijgerecht van {bijgerecht}', +sep='\n' + emoji +) + +\--- /code --- + +
+ +
+ +### Tip + +Probeer de variabele `emoji` bovenaan te veranderen in iets schattigs zoals:
+• 🍽️😋
+• 🧁
+• 🍱 + +
diff --git a/nl-NL/step_4.md b/nl-NL/step_4.md new file mode 100644 index 0000000..bf49c2f --- /dev/null +++ b/nl-NL/step_4.md @@ -0,0 +1,40 @@ +

Corrigeer de opmaak van de ingrediënten

+ +\--- task --- + +Gebruik `.title()` en `.lower()` voor de ingrediëntwaarden binnen de `print()`-regel. + +\--- /task --- + +

Zorg dat de ingrediënten leesbaar zijn

+ +De ingrediënten staan allemaal in hoofdletters geschreven — laten we ze in het uiteindelijke recept beter leesbaar maken. + +- Gebruik `.lower()` om alle woorden in kleine letters weer te geven + +Werk elk van de `print()`-regels bij. Hieronder zijn al twee regels voor je gedaan. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 14 +line_highlights: +--- + +f'Voeg gegrilde {eiwitten.lower()} toe' +f'Garneer met {garnering.lower()}' + +\--- /code --- + +
+ +
+ +### Foutopsporing + +Zorg ervoor dat de haakjes en accolades correct overeenkomen wanneer je `.lower()` binnen een tekenreeks aanroept. + +
diff --git a/nl-NL/step_5.md b/nl-NL/step_5.md new file mode 100644 index 0000000..cc15dcf --- /dev/null +++ b/nl-NL/step_5.md @@ -0,0 +1,43 @@ +

Saboteer het recept met .replace()

+ +\--- task --- + +Gebruik `.replace()` om ingrediënten stiekem te vervangen door walgelijke ingrediënten! + +\--- /task --- + +

Laat de grap beginnen

+ +Nu je recept er prachtig uitziet… is tijd om het te verpesten 😂 + +Gebruik `.replace()` om de waarden van je variabelen **bovenaan** je code stilzwijgend te wijzigen. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 2 +line_highlights: +--- + +eiwitten = 'TOFU'.replace('FU', 'NG') # ➝ TONG +groente_1 = 'WORTEL'.replace('RTE', '') # ➝ WOL + +\--- /code --- + +
+ +
+ +### Tip + +Hier zijn nog meer ideeën: + +- ERWTEN ➝ WATTEN +- RIJST ➝ ROEST +- GEKOOKTE EIEREN ➝ BEDORVEN EIEREN +- MUNT ➝ MUIZEN + +
diff --git a/nl-NL/step_6.md b/nl-NL/step_6.md new file mode 100644 index 0000000..8eb1b78 --- /dev/null +++ b/nl-NL/step_6.md @@ -0,0 +1,60 @@ +

Vervang de emoji voor de lol (of de horror)

+ +\--- task --- + +Gebruik `.replace()` op de emoji-variabele om schattige opsommingstekens in griezelige te veranderen. + +\--- /task --- + +

Verander de stemming met emoji's

+ +Je emoji-opsommingstekens zien er smakelijk uit, maar laten we daar verandering in brengen! + +Gebruik `.replace()` op de variabele `emoji` om vrolijke symbolen in iets afschuwelijks te veranderen. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🍽️😋'.replace('😋', '🤢') # ➝ 🍽️🤢 + +\--- /code --- + +
+ +Of vervang het geheel volledig: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🪳💀' + +\--- /code --- + +
+ +
+ +### Tip + +Andere emoji-opties om te proberen:
+• 🦗
+• 💩
+• 🧟
+• ☠️
+• 🐛 + +
\ No newline at end of file diff --git a/pt-BR/code/starter/main.py b/pt-BR/code/starter/main.py new file mode 100644 index 0000000..a68ddac --- /dev/null +++ b/pt-BR/code/starter/main.py @@ -0,0 +1,11 @@ +# Ingredients +protein = 'TOFU' +veg_1 = 'CARROT' +veg_2 = 'PEAS' +carb = 'RICE' +side = 'BOILED EGGS' +garnish = 'MINT' +emoji = '🍽️😋' + +# Final recipe print +print(f'Start with a scoop of {carb}',f'Top with diced {veg_1} and {veg_2}',f'Add grilled {protein}',f'Garnish with {garnish}',f'Serve with a side of {side}') \ No newline at end of file diff --git a/pt-BR/code/starter/project_config.yml b/pt-BR/code/starter/project_config.yml new file mode 100644 index 0000000..3d8d40c --- /dev/null +++ b/pt-BR/code/starter/project_config.yml @@ -0,0 +1,4 @@ +name: "Python bytes - Recipe wreckers" +identifier: "python-bytes-recipe-wreckers" +type: 'python' +build: true diff --git a/pt-BR/images/banner.png b/pt-BR/images/banner.png new file mode 100644 index 0000000..454465b Binary files /dev/null and b/pt-BR/images/banner.png differ diff --git a/pt-BR/meta.yml b/pt-BR/meta.yml new file mode 100644 index 0000000..912eb26 --- /dev/null +++ b/pt-BR/meta.yml @@ -0,0 +1,21 @@ +title: Python bytes - Recipe wreckers +hero_image: images/banner.png +description: Create and secretly sabotage a recipe using Python print formatting and string methods. +meta_title: Python coding projects for kids and teens | Recipe Wreckers +meta_description: Learn Python with the Raspberry Pi Foundation. Make and secretly ruin a recipe using print(), f-strings, emoji, and .replace(). +version: 1 +listed: true +copyedit: false +last_tested: "2025-04-04" +steps: + - title: step_1 + - title: step_2 + completion: + - engaged + - title: step_3 + - title: step_4 + - title: step_5 + - title: step_6 + completion: + - internal + - external diff --git a/pt-BR/resources/mentor.md b/pt-BR/resources/mentor.md new file mode 100644 index 0000000..b5d1f85 --- /dev/null +++ b/pt-BR/resources/mentor.md @@ -0,0 +1,47 @@ +# Mentor Notes: Recipe Wreckers + +## Overview + +This lesson builds on the basics of `print()` and f-strings by introducing: + +- Print formatting using `sep=` and `end=` +- String case methods (`.lower()`) +- Pranking techniques with `.replace()` +- Visual enhancement with emoji + +Learners take an existing recipe and gradually transform it into something easier to read, then secretly sabotage it for fun. + +--- + +## What They Will Learn + +- How to split long lines of code for readability +- How to use `sep='\n'` to add line breaks +- How to insert emoji as bullet points +- How to use `.lower()` for styling +- How to use `.replace()` for creative pranks + +--- + +## Tips + +- Encourage experimentation with emoji +- Learners should run code before and after each step to understand the impact +- Reinforce that `.replace()` doesn’t change the original string — it returns a new one + +--- + +## Challenges + +- Ensuring correct placement of `sep=`, especially when using emoji + newline +- Using `.replace()` safely without breaking strings +- Managing variable names consistently between tasks + +--- + +## Extension Ideas + +- Ask learners to write their own recipe and sabotage it +- Introduce `.count()` or `.find()` to inspect string contents +- Create a two-option prank menu using conditionals (if ready) + diff --git a/pt-BR/solutions/main.py b/pt-BR/solutions/main.py new file mode 100644 index 0000000..304a1f6 --- /dev/null +++ b/pt-BR/solutions/main.py @@ -0,0 +1,17 @@ +emoji = '🍽️😋'.replace('😋', '🤢') + +protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD +veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT +carb = 'RICE'.replace('R', 'L') # ➝ LICE +veg_2 = 'PEAS' +garnish = 'MINT' +side = 'BOILED EGGS' + +print( + f'{emoji} Start with a scoop of {carb.lower()}', + f'Top with diced {veg_1.lower()} and {veg_2.lower()}', + f'Add grilled {protein.title()}', + f'Garnish with {garnish.lower()}', + f'Serve with a side of {side.lower()}', + sep='\n' +) diff --git a/pt-BR/step_1.md b/pt-BR/step_1.md new file mode 100644 index 0000000..e94d874 --- /dev/null +++ b/pt-BR/step_1.md @@ -0,0 +1,50 @@ +

Make the code easier to read

+ +\--- task --- + +Split the long print statement onto multiple lines so it’s easier to understand. + +\--- /task --- + +

Readable code is good code

+ +A café manager has written all the recipe print parts on one long line — it works, but it's hard to read! + +Luckily, Python lets you write long `print()` statements across multiple lines. +You just need to **end each part with a comma**, and Python will still treat it as one command. + +--- + +**Run the program once** before making changes and look at the output. +Then split the print statement across multiple lines and run it again. +The output should be the same — but the code is much easier to read! + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: +--- + +print( +f'Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}' +) + +\--- /code --- + +
+ +
+ +### Tip + +Make sure you leave **commas** at the end of each line inside the print statement! + +
diff --git a/pt-BR/step_2.md b/pt-BR/step_2.md new file mode 100644 index 0000000..4f7bf91 --- /dev/null +++ b/pt-BR/step_2.md @@ -0,0 +1,50 @@ +

Fix the output format

+ +\--- task --- + +Use `sep='\n'` to print each part of the recipe on its own line. + +\--- /task --- + +

Split the output into lines

+ +Right now, all the recipe lines appear squashed together. +You can use the `sep=` option in `print()` to tell Python what to put **between** each item. + +By setting `sep='\n'`, you’ll get a **new line** between every part of the print. + +Here’s what your code should look like: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 17 +--- + +print( +f'Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}', +sep='\n' +) + +\--- /code --- + +
+ +
+ +### Debugging + +If your recipe is still on one line, check: + +- Did you add `sep='\n'` at the end of the `print()`? +- Are the commas in place after each line? + +
diff --git a/pt-BR/step_3.md b/pt-BR/step_3.md new file mode 100644 index 0000000..5c9d299 --- /dev/null +++ b/pt-BR/step_3.md @@ -0,0 +1,49 @@ +

Add emoji bullets

+ +\--- task --- + +Use the emoji variable to add a bullet point to every line. + +\--- /task --- + +

Make your list look amazing

+ +Now that the lines are separated, let’s add some bullet points! + +You can do this by changing the separator again, this time to `sep='\n' + emoji`. + +Also, you’ll want to manually add the emoji at the **start of the first line**, since `sep` only adds it _between_ lines. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 12, 17 +--- + +print( +f'{emoji}Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}', +sep='\n' + emoji +) + +\--- /code --- + +
+ +
+ +### Tip + +Try changing the `emoji` variable at the top to something cute like:
+• 🍽️😋
+• 🧁
+• 🍱 + +
diff --git a/pt-BR/step_4.md b/pt-BR/step_4.md new file mode 100644 index 0000000..616168b --- /dev/null +++ b/pt-BR/step_4.md @@ -0,0 +1,40 @@ +

Fix the ingredient formatting

+ +\--- task --- + +Use `.title()` and `.lower()` on the ingredient values inside the `print()` line. + +\--- /task --- + +

Make the ingredients readable

+ +The ingredients are written in all uppercase — let’s make them easier to read in the final recipe. + +- Use `.lower()` to make all the letters lowercase + +Update each of the `print()` lines. Two lines have been done for you below. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 14 +line_highlights: +--- + +f'Add grilled {protein.lower()}' +f'Garnish with {garnish.lower()}' + +\--- /code --- + +
+ +
+ +### Debugging + +Make sure your parentheses and curly braces match correctly when calling `.lower()` inside a string. + +
diff --git a/pt-BR/step_5.md b/pt-BR/step_5.md new file mode 100644 index 0000000..dc10299 --- /dev/null +++ b/pt-BR/step_5.md @@ -0,0 +1,43 @@ +

Sabotage the recipe with .replace()

+ +\--- task --- + +Use `.replace()` to secretly swap ingredients with disgusting ones! + +\--- /task --- + +

Let the prank begin

+ +Now that your recipe looks beautiful… it’s time to ruin it 😂 + +Use `.replace()` to quietly change the values of your variables **at the top** of your code. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 2 +line_highlights: +--- + +protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD +veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT + +\--- /code --- + +
+ +
+ +### Tip + +Here are more ideas: + +- PEAS ➝ FLEAS +- RICE ➝ LICE +- BOILED EGGS ➝ SPOILED EGGS +- MINT ➝ PAINT + +
diff --git a/pt-BR/step_6.md b/pt-BR/step_6.md new file mode 100644 index 0000000..6ccaf1f --- /dev/null +++ b/pt-BR/step_6.md @@ -0,0 +1,60 @@ +

Replace the emoji for fun (or horror)

+ +\--- task --- + +Use `.replace()` on the emoji variable to turn cute bullets into creepy ones. + +\--- /task --- + +

Change the mood with emoji

+ +Your emoji bullets look tasty — but let’s change that! + +Use `.replace()` on the `emoji` variable to turn happy symbols into something horrible. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🍽️😋'.replace('😋', '🤢') # ➝ 🍽️🤢 + +\--- /code --- + +
+ +Or replace the whole thing completely: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🪳💀' + +\--- /code --- + +
+ +
+ +### Tip + +Other emoji options to try:
+• 🦗
+• 💩
+• 🧟
+• ☠️
+• 🐛 + +
\ No newline at end of file diff --git a/uk-UA/code/starter/main.py b/uk-UA/code/starter/main.py new file mode 100644 index 0000000..a68ddac --- /dev/null +++ b/uk-UA/code/starter/main.py @@ -0,0 +1,11 @@ +# Ingredients +protein = 'TOFU' +veg_1 = 'CARROT' +veg_2 = 'PEAS' +carb = 'RICE' +side = 'BOILED EGGS' +garnish = 'MINT' +emoji = '🍽️😋' + +# Final recipe print +print(f'Start with a scoop of {carb}',f'Top with diced {veg_1} and {veg_2}',f'Add grilled {protein}',f'Garnish with {garnish}',f'Serve with a side of {side}') \ No newline at end of file diff --git a/uk-UA/code/starter/project_config.yml b/uk-UA/code/starter/project_config.yml new file mode 100644 index 0000000..3d8d40c --- /dev/null +++ b/uk-UA/code/starter/project_config.yml @@ -0,0 +1,4 @@ +name: "Python bytes - Recipe wreckers" +identifier: "python-bytes-recipe-wreckers" +type: 'python' +build: true diff --git a/uk-UA/images/banner.png b/uk-UA/images/banner.png new file mode 100644 index 0000000..454465b Binary files /dev/null and b/uk-UA/images/banner.png differ diff --git a/uk-UA/meta.yml b/uk-UA/meta.yml new file mode 100644 index 0000000..912eb26 --- /dev/null +++ b/uk-UA/meta.yml @@ -0,0 +1,21 @@ +title: Python bytes - Recipe wreckers +hero_image: images/banner.png +description: Create and secretly sabotage a recipe using Python print formatting and string methods. +meta_title: Python coding projects for kids and teens | Recipe Wreckers +meta_description: Learn Python with the Raspberry Pi Foundation. Make and secretly ruin a recipe using print(), f-strings, emoji, and .replace(). +version: 1 +listed: true +copyedit: false +last_tested: "2025-04-04" +steps: + - title: step_1 + - title: step_2 + completion: + - engaged + - title: step_3 + - title: step_4 + - title: step_5 + - title: step_6 + completion: + - internal + - external diff --git a/uk-UA/resources/mentor.md b/uk-UA/resources/mentor.md new file mode 100644 index 0000000..b5d1f85 --- /dev/null +++ b/uk-UA/resources/mentor.md @@ -0,0 +1,47 @@ +# Mentor Notes: Recipe Wreckers + +## Overview + +This lesson builds on the basics of `print()` and f-strings by introducing: + +- Print formatting using `sep=` and `end=` +- String case methods (`.lower()`) +- Pranking techniques with `.replace()` +- Visual enhancement with emoji + +Learners take an existing recipe and gradually transform it into something easier to read, then secretly sabotage it for fun. + +--- + +## What They Will Learn + +- How to split long lines of code for readability +- How to use `sep='\n'` to add line breaks +- How to insert emoji as bullet points +- How to use `.lower()` for styling +- How to use `.replace()` for creative pranks + +--- + +## Tips + +- Encourage experimentation with emoji +- Learners should run code before and after each step to understand the impact +- Reinforce that `.replace()` doesn’t change the original string — it returns a new one + +--- + +## Challenges + +- Ensuring correct placement of `sep=`, especially when using emoji + newline +- Using `.replace()` safely without breaking strings +- Managing variable names consistently between tasks + +--- + +## Extension Ideas + +- Ask learners to write their own recipe and sabotage it +- Introduce `.count()` or `.find()` to inspect string contents +- Create a two-option prank menu using conditionals (if ready) + diff --git a/uk-UA/solutions/main.py b/uk-UA/solutions/main.py new file mode 100644 index 0000000..304a1f6 --- /dev/null +++ b/uk-UA/solutions/main.py @@ -0,0 +1,17 @@ +emoji = '🍽️😋'.replace('😋', '🤢') + +protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD +veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT +carb = 'RICE'.replace('R', 'L') # ➝ LICE +veg_2 = 'PEAS' +garnish = 'MINT' +side = 'BOILED EGGS' + +print( + f'{emoji} Start with a scoop of {carb.lower()}', + f'Top with diced {veg_1.lower()} and {veg_2.lower()}', + f'Add grilled {protein.title()}', + f'Garnish with {garnish.lower()}', + f'Serve with a side of {side.lower()}', + sep='\n' +) diff --git a/uk-UA/step_1.md b/uk-UA/step_1.md new file mode 100644 index 0000000..e94d874 --- /dev/null +++ b/uk-UA/step_1.md @@ -0,0 +1,50 @@ +

Make the code easier to read

+ +\--- task --- + +Split the long print statement onto multiple lines so it’s easier to understand. + +\--- /task --- + +

Readable code is good code

+ +A café manager has written all the recipe print parts on one long line — it works, but it's hard to read! + +Luckily, Python lets you write long `print()` statements across multiple lines. +You just need to **end each part with a comma**, and Python will still treat it as one command. + +--- + +**Run the program once** before making changes and look at the output. +Then split the print statement across multiple lines and run it again. +The output should be the same — but the code is much easier to read! + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: +--- + +print( +f'Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}' +) + +\--- /code --- + +
+ +
+ +### Tip + +Make sure you leave **commas** at the end of each line inside the print statement! + +
diff --git a/uk-UA/step_2.md b/uk-UA/step_2.md new file mode 100644 index 0000000..4f7bf91 --- /dev/null +++ b/uk-UA/step_2.md @@ -0,0 +1,50 @@ +

Fix the output format

+ +\--- task --- + +Use `sep='\n'` to print each part of the recipe on its own line. + +\--- /task --- + +

Split the output into lines

+ +Right now, all the recipe lines appear squashed together. +You can use the `sep=` option in `print()` to tell Python what to put **between** each item. + +By setting `sep='\n'`, you’ll get a **new line** between every part of the print. + +Here’s what your code should look like: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 17 +--- + +print( +f'Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}', +sep='\n' +) + +\--- /code --- + +
+ +
+ +### Debugging + +If your recipe is still on one line, check: + +- Did you add `sep='\n'` at the end of the `print()`? +- Are the commas in place after each line? + +
diff --git a/uk-UA/step_3.md b/uk-UA/step_3.md new file mode 100644 index 0000000..5c9d299 --- /dev/null +++ b/uk-UA/step_3.md @@ -0,0 +1,49 @@ +

Add emoji bullets

+ +\--- task --- + +Use the emoji variable to add a bullet point to every line. + +\--- /task --- + +

Make your list look amazing

+ +Now that the lines are separated, let’s add some bullet points! + +You can do this by changing the separator again, this time to `sep='\n' + emoji`. + +Also, you’ll want to manually add the emoji at the **start of the first line**, since `sep` only adds it _between_ lines. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 11 +line_highlights: 12, 17 +--- + +print( +f'{emoji}Start with a scoop of {carb}', +f'Top with diced {veg_1} and {veg_2}', +f'Add grilled {protein}', +f'Garnish with {garnish}', +f'Serve with a side of {side}', +sep='\n' + emoji +) + +\--- /code --- + +
+ +
+ +### Tip + +Try changing the `emoji` variable at the top to something cute like:
+• 🍽️😋
+• 🧁
+• 🍱 + +
diff --git a/uk-UA/step_4.md b/uk-UA/step_4.md new file mode 100644 index 0000000..616168b --- /dev/null +++ b/uk-UA/step_4.md @@ -0,0 +1,40 @@ +

Fix the ingredient formatting

+ +\--- task --- + +Use `.title()` and `.lower()` on the ingredient values inside the `print()` line. + +\--- /task --- + +

Make the ingredients readable

+ +The ingredients are written in all uppercase — let’s make them easier to read in the final recipe. + +- Use `.lower()` to make all the letters lowercase + +Update each of the `print()` lines. Two lines have been done for you below. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 14 +line_highlights: +--- + +f'Add grilled {protein.lower()}' +f'Garnish with {garnish.lower()}' + +\--- /code --- + +
+ +
+ +### Debugging + +Make sure your parentheses and curly braces match correctly when calling `.lower()` inside a string. + +
diff --git a/uk-UA/step_5.md b/uk-UA/step_5.md new file mode 100644 index 0000000..dc10299 --- /dev/null +++ b/uk-UA/step_5.md @@ -0,0 +1,43 @@ +

Sabotage the recipe with .replace()

+ +\--- task --- + +Use `.replace()` to secretly swap ingredients with disgusting ones! + +\--- /task --- + +

Let the prank begin

+ +Now that your recipe looks beautiful… it’s time to ruin it 😂 + +Use `.replace()` to quietly change the values of your variables **at the top** of your code. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 2 +line_highlights: +--- + +protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD +veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT + +\--- /code --- + +
+ +
+ +### Tip + +Here are more ideas: + +- PEAS ➝ FLEAS +- RICE ➝ LICE +- BOILED EGGS ➝ SPOILED EGGS +- MINT ➝ PAINT + +
diff --git a/uk-UA/step_6.md b/uk-UA/step_6.md new file mode 100644 index 0000000..6ccaf1f --- /dev/null +++ b/uk-UA/step_6.md @@ -0,0 +1,60 @@ +

Replace the emoji for fun (or horror)

+ +\--- task --- + +Use `.replace()` on the emoji variable to turn cute bullets into creepy ones. + +\--- /task --- + +

Change the mood with emoji

+ +Your emoji bullets look tasty — but let’s change that! + +Use `.replace()` on the `emoji` variable to turn happy symbols into something horrible. + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🍽️😋'.replace('😋', '🤢') # ➝ 🍽️🤢 + +\--- /code --- + +
+ +Or replace the whole thing completely: + +
+--- code --- +--- +language: python +filename: main.py +line_numbers: true +line_number_start: 8 +line_highlights: +--- + +emoji = '🪳💀' + +\--- /code --- + +
+ +
+ +### Tip + +Other emoji options to try:
+• 🦗
+• 💩
+• 🧟
+• ☠️
+• 🐛 + +
\ No newline at end of file