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/meta.yml b/fr-FR/meta.yml index 50b7f94..91d9b29 100644 --- a/fr-FR/meta.yml +++ b/fr-FR/meta.yml @@ -1,4 +1,3 @@ ---- 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. diff --git a/fr-FR/step_1.md b/fr-FR/step_1.md index a880b6b..804a83d 100644 --- a/fr-FR/step_1.md +++ b/fr-FR/step_1.md @@ -1,10 +1,10 @@

Faciliter la lecture du code

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

Un code lisible est un bon code

@@ -30,14 +30,14 @@ 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}' +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 --- +\--- /code --- diff --git a/fr-FR/step_2.md b/fr-FR/step_2.md index 0beba02..e114ce8 100644 --- a/fr-FR/step_2.md +++ b/fr-FR/step_2.md @@ -1,10 +1,10 @@

Corriger le format de sortie

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

Diviser la sortie en lignes

@@ -26,15 +26,15 @@ 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' +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 --- +\--- /code --- diff --git a/fr-FR/step_3.md b/fr-FR/step_3.md index 0b95b18..3df2a11 100644 --- a/fr-FR/step_3.md +++ b/fr-FR/step_3.md @@ -1,10 +1,10 @@

Ajouter des puces emoji

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

Embellir ta liste

@@ -25,15 +25,15 @@ 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' +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 --- +\--- /code --- diff --git a/fr-FR/step_4.md b/fr-FR/step_4.md index a437314..857689c 100644 --- a/fr-FR/step_4.md +++ b/fr-FR/step_4.md @@ -1,10 +1,10 @@

Corriger le formatage des ingrédients

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

Rendre les ingrédients lisibles

@@ -27,7 +27,7 @@ line_highlights: f'Ajoutez des {proteine.lower()} grillées' f'Garnisez avec {accompagnement.lower()}' ---- /code --- +\--- /code --- diff --git a/fr-FR/step_5.md b/fr-FR/step_5.md index f717423..b671b42 100644 --- a/fr-FR/step_5.md +++ b/fr-FR/step_5.md @@ -1,10 +1,10 @@

Sabotage de la recette avec la fonction .replace()

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

Que la farce commence

@@ -25,7 +25,7 @@ line_highlights: proteine = 'TOFU'.replace('FU', 'RTUE') # ➝ TORTUE veg_1 = 'CAROTTE'.replace('CAR', 'B') # ➝ BOTTE ---- /code --- +\--- /code --- diff --git a/fr-FR/step_6.md b/fr-FR/step_6.md index 9c92140..3f43f67 100644 --- a/fr-FR/step_6.md +++ b/fr-FR/step_6.md @@ -1,10 +1,10 @@

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

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

Changer d'ambiance avec des emojis

@@ -24,7 +24,7 @@ line_highlights: emoji = '🍽️😋'.replace('😋', '🤢') # ➝ 🍽️🤢 ---- /code --- +\--- /code --- @@ -42,7 +42,7 @@ line_highlights: emoji = '🪳💀' ---- /code --- +\--- /code --- @@ -57,14 +57,4 @@ Autres emojis à essayer :
• ☠️
• 🐛 - - -*** - -Ce projet a été traduit par des bénévoles: - -Michel Arnols - -Jonathan Vannieuwkerke - -Grâce aux bénévoles, nous pouvons donner aux gens du monde entier la chance d'apprendre dans leur propre langue. Vous pouvez nous aider à atteindre plus de personnes en vous portant volontaire pour la traduction - plus d'informations sur [rpf.io/translate](https://rpf.io/translate). + \ 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/meta.yml b/nl-NL/meta.yml index 81c366a..f821447 100644 --- a/nl-NL/meta.yml +++ b/nl-NL/meta.yml @@ -1,4 +1,3 @@ ---- title: Python-bytes - Receptverpesters hero_image: images/banner.png description: Maak en saboteer stiekem een recept met behulp van Python-opmaakfuncties en tekenreeksmethoden. diff --git a/nl-NL/step_1.md b/nl-NL/step_1.md index cdd19da..565bff2 100644 --- a/nl-NL/step_1.md +++ b/nl-NL/step_1.md @@ -1,10 +1,10 @@

Maak de code gemakkelijker te lezen

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

Leesbare code is goede code

@@ -30,14 +30,14 @@ 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}' +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 --- +\--- /code --- diff --git a/nl-NL/step_2.md b/nl-NL/step_2.md index b07e8af..b9631e5 100644 --- a/nl-NL/step_2.md +++ b/nl-NL/step_2.md @@ -1,10 +1,10 @@

Corrigeer het uitvoerformaat

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

Splits de uitvoer in regels

@@ -26,15 +26,15 @@ 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' +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 --- +\--- /code --- diff --git a/nl-NL/step_3.md b/nl-NL/step_3.md index 1c07bc5..22e2a08 100644 --- a/nl-NL/step_3.md +++ b/nl-NL/step_3.md @@ -1,10 +1,10 @@

Voeg emoji-opsommingstekens toe

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

Zorg dat je lijst er fantastisch uitziet

@@ -25,15 +25,15 @@ 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 +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 --- +\--- /code --- diff --git a/nl-NL/step_4.md b/nl-NL/step_4.md index 6aa3e67..bf49c2f 100644 --- a/nl-NL/step_4.md +++ b/nl-NL/step_4.md @@ -1,10 +1,10 @@

Corrigeer de opmaak van de ingrediënten

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

Zorg dat de ingrediënten leesbaar zijn

@@ -27,7 +27,7 @@ line_highlights: f'Voeg gegrilde {eiwitten.lower()} toe' f'Garneer met {garnering.lower()}' ---- /code --- +\--- /code --- diff --git a/nl-NL/step_5.md b/nl-NL/step_5.md index 047a0ff..cc15dcf 100644 --- a/nl-NL/step_5.md +++ b/nl-NL/step_5.md @@ -1,10 +1,10 @@

Saboteer het recept met .replace()

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

Laat de grap beginnen

@@ -25,7 +25,7 @@ line_highlights: eiwitten = 'TOFU'.replace('FU', 'NG') # ➝ TONG groente_1 = 'WORTEL'.replace('RTE', '') # ➝ WOL ---- /code --- +\--- /code --- diff --git a/nl-NL/step_6.md b/nl-NL/step_6.md index d726275..8eb1b78 100644 --- a/nl-NL/step_6.md +++ b/nl-NL/step_6.md @@ -1,10 +1,10 @@

Vervang de emoji voor de lol (of de horror)

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

Verander de stemming met emoji's

@@ -24,7 +24,7 @@ line_highlights: emoji = '🍽️😋'.replace('😋', '🤢') # ➝ 🍽️🤢 ---- /code --- +\--- /code --- @@ -42,7 +42,7 @@ line_highlights: emoji = '🪳💀' ---- /code --- +\--- /code --- @@ -57,14 +57,4 @@ Andere emoji-opties om te proberen:
• ☠️
• 🐛 - - -*** - -Dit project werd vertaald door vrijwilligers: - -Robert-Jan Kempenaar - -Iny van Beuningen - -Dankzij vrijwilligers kunnen we mensen over de hele wereld de kans geven om in hun eigen taal te leren. Jij kunt ons helpen meer mensen te bereiken door vrijwillig te starten met vertalen - meer informatie op [rpf.io/translate](https://rpf.io/translate). + \ 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