Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions de-DE/code/starter/main.py
Original file line number Diff line number Diff line change
@@ -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}')
4 changes: 4 additions & 0 deletions de-DE/code/starter/project_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: "Python bytes - Recipe wreckers"
identifier: "python-bytes-recipe-wreckers"
type: 'python'
build: true
Binary file added de-DE/images/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions de-DE/meta.yml
Original file line number Diff line number Diff line change
@@ -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
47 changes: 47 additions & 0 deletions de-DE/resources/mentor.md
Original file line number Diff line number Diff line change
@@ -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)

17 changes: 17 additions & 0 deletions de-DE/solutions/main.py
Original file line number Diff line number Diff line change
@@ -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'
)
50 changes: 50 additions & 0 deletions de-DE/step_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<h2 class="c-project-heading--task">Make the code easier to read</h2>

\--- task ---

Split the long print statement onto multiple lines so it’s easier to understand.

\--- /task ---

<h2 class="c-project-heading--explainer">Readable code is good code</h2>

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!

<div class="c-project-code">
--- 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 ---

</div>

<div class="c-project-callout c-project-callout--tip">

### Tip

Make sure you leave **commas** at the end of each line inside the print statement!

</div>
50 changes: 50 additions & 0 deletions de-DE/step_2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<h2 class="c-project-heading--task">Fix the output format</h2>

\--- task ---

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

\--- /task ---

<h2 class="c-project-heading--explainer">Split the output into lines</h2>

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:

<div class="c-project-code">
--- 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 ---

</div>

<div class="c-project-callout c-project-callout--debug">

### 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?

</div>
49 changes: 49 additions & 0 deletions de-DE/step_3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<h2 class="c-project-heading--task">Add emoji bullets</h2>

\--- task ---

Use the emoji variable to add a bullet point to every line.

\--- /task ---

<h2 class="c-project-heading--explainer">Make your list look amazing</h2>

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.

<div class="c-project-code">
--- 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 ---

</div>

<div class="c-project-callout c-project-callout--tip">

### Tip

Try changing the `emoji` variable at the top to something cute like:<br />
• 🍽️😋<br />
• 🧁<br />
• 🍱

</div>
40 changes: 40 additions & 0 deletions de-DE/step_4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<h2 class="c-project-heading--task">Fix the ingredient formatting</h2>

\--- task ---

Use `.title()` and `.lower()` on the ingredient values inside the `print()` line.

\--- /task ---

<h2 class="c-project-heading--explainer">Make the ingredients readable</h2>

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.

<div class="c-project-code">
--- 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 ---

</div>

<div class="c-project-callout c-project-callout--debug">

### Debugging

Make sure your parentheses and curly braces match correctly when calling `.lower()` inside a string.

</div>
43 changes: 43 additions & 0 deletions de-DE/step_5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<h2 class="c-project-heading--task">Sabotage the recipe with .replace()</h2>

\--- task ---

Use `.replace()` to secretly swap ingredients with disgusting ones!

\--- /task ---

<h2 class="c-project-heading--explainer">Let the prank begin</h2>

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.

<div class="c-project-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 ---

</div>

<div class="c-project-callout c-project-callout--tip">

### Tip

Here are more ideas:

- PEAS ➝ FLEAS
- RICE ➝ LICE
- BOILED EGGS ➝ SPOILED EGGS
- MINT ➝ PAINT

</div>
Loading