File tree Expand file tree Collapse file tree 6 files changed +39
-1
lines changed
Expand file tree Collapse file tree 6 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 11<h2 class =" c-project-heading--task " >Make the code easier to read</h2 >
2+
23--- task ---
4+
35Split the long print statement onto multiple lines so it’s easier to understand.
6+
47--- /task ---
58
69<h2 class =" c-project-heading--explainer " >Readable code is good code</h2 >
@@ -25,14 +28,17 @@ line_numbers: true
2528line_number_start: 11
2629line_highlights:
2730---
31+
2832print(
2933 f'Start with a scoop of {carb}',
3034 f'Top with diced {veg_1} and {veg_2}',
3135 f'Add grilled {protein}',
3236 f'Garnish with {garnish}',
3337 f'Serve with a side of {side}'
3438)
39+
3540--- /code ---
41+
3642</div >
3743
3844<div class =" c-project-callout c-project-callout--tip " >
Original file line number Diff line number Diff line change 11<h2 class =" c-project-heading--task " >Fix the output format</h2 >
2+
23--- task ---
4+
35Use ` sep='\n' ` to print each part of the recipe on its own line.
6+
47--- /task ---
58
69<h2 class =" c-project-heading--explainer " >Split the output into lines</h2 >
@@ -20,8 +23,8 @@ filename: main.py
2023line_numbers: true
2124line_number_start: 11
2225line_highlights: 17
23-
2426---
27+
2528print(
2629 f'Start with a scoop of {carb}',
2730 f'Top with diced {veg_1} and {veg_2}',
3033 f'Serve with a side of {side}',
3134 sep='\n'
3235)
36+
3337--- /code ---
38+
3439</div >
3540
3641<div class =" c-project-callout c-project-callout--debug " >
Original file line number Diff line number Diff line change 11
22<h2 class =" c-project-heading--task " >Add emoji bullets</h2 >
3+
34--- task ---
5+
46Use the emoji variable to add a bullet point to every line.
7+
58--- /task ---
69
710<h2 class =" c-project-heading--explainer " >Make your list look amazing</h2 >
@@ -21,6 +24,7 @@ line_numbers: true
2124line_number_start: 11
2225line_highlights: 12, 17
2326---
27+
2428print(
2529 f'{emoji}Start with a scoop of {carb}',
2630 f'Top with diced {veg_1} and {veg_2}',
2933 f'Serve with a side of {side}',
3034 sep='\n' + emoji
3135)
36+
3237--- /code ---
38+
3339</div >
3440
3541<div class =" c-project-callout c-project-callout--tip " >
Original file line number Diff line number Diff line change 11<h2 class =" c-project-heading--task " >Fix the ingredient formatting</h2 >
2+
23--- task ---
4+
35Use ` .title() ` and ` .lower() ` on the ingredient values inside the ` print() ` line.
6+
47--- /task ---
58
69<h2 class =" c-project-heading--explainer " >Make the ingredients readable</h2 >
@@ -20,9 +23,12 @@ line_numbers: true
2023line_number_start: 14
2124line_highlights:
2225---
26+
2327f'Add grilled {protein.lower()}'
2428f'Garnish with {garnish.lower()}'
29+
2530--- /code ---
31+
2632</div >
2733
2834<div class =" c-project-callout c-project-callout--debug " >
Original file line number Diff line number Diff line change 11<h2 class =" c-project-heading--task " >Sabotage the recipe with .replace()</h2 >
2+
23--- task ---
4+
35Use ` .replace() ` to secretly swap ingredients with disgusting ones!
6+
47--- /task ---
58
69<h2 class =" c-project-heading--explainer " >Let the prank begin</h2 >
@@ -18,9 +21,12 @@ line_numbers: true
1821line_number_start: 2
1922line_highlights:
2023---
24+
2125protein = 'TOFU'.replace('FU', 'AD') # ➝ TOAD
2226veg_1 = 'CARROT'.replace('CAR', '') # ➝ ROT
27+
2328--- /code ---
29+
2430</div >
2531
2632<div class =" c-project-callout c-project-callout--tip " >
Original file line number Diff line number Diff line change 11<h2 class =" c-project-heading--task " >Replace the emoji for fun (or horror)</h2 >
2+
23--- task ---
4+
35Use ` .replace() ` on the emoji variable to turn cute bullets into creepy ones.
6+
47--- /task ---
58
69<h2 class =" c-project-heading--explainer " >Change the mood with emoji</h2 >
@@ -18,8 +21,11 @@ line_numbers: true
1821line_number_start: 8
1922line_highlights:
2023---
24+
2125emoji = '🍽️😋'.replace('😋', '🤢') # ➝ 🍽️🤢
26+
2227--- /code ---
28+
2329</div >
2430
2531Or replace the whole thing completely:
@@ -33,8 +39,11 @@ line_numbers: true
3339line_number_start: 8
3440line_highlights:
3541---
42+
3643emoji = '🪳💀'
44+
3745--- /code ---
46+
3847</div >
3948
4049<div class =" c-project-callout c-project-callout--tip " >
You can’t perform that action at this time.
0 commit comments