From 5d6860f4c4c226547cbbeae659ab53fc713fe9cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=E1=BA=A3o=20Nguy=E1=BB=85n?= <100182329+nguyenduybao1@users.noreply.github.com> Date: Wed, 4 Mar 2026 14:37:42 +0700 Subject: [PATCH] fix(curriculum): clarify step 4 instructions and update tests (#66047) --- .../69779dcb44016eccc05c15a4.md | 2 +- .../6977a4306bb3e856690a4890.md | 2 +- .../6977a8bbcbdd557886bd0718.md | 2 +- .../697a7f71ebfcd9e4cacd69c2.md | 4 ++-- .../6982684f3a25f379e195a5fc.md | 14 +++++++++++--- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/curriculum/challenges/english/blocks/workshop-bill-splitter/69779dcb44016eccc05c15a4.md b/curriculum/challenges/english/blocks/workshop-bill-splitter/69779dcb44016eccc05c15a4.md index 7ffa0cc630a..c198b717111 100644 --- a/curriculum/challenges/english/blocks/workshop-bill-splitter/69779dcb44016eccc05c15a4.md +++ b/curriculum/challenges/english/blocks/workshop-bill-splitter/69779dcb44016eccc05c15a4.md @@ -64,7 +64,7 @@ main_courses = 57.34 desserts = 39.39 drinks = 64.21 -running_total = appetizers + main_courses + desserts + drinks +running_total += appetizers + main_courses + desserts + drinks print('Total bill so far:', running_total) --fcc-editable-region-- diff --git a/curriculum/challenges/english/blocks/workshop-bill-splitter/6977a4306bb3e856690a4890.md b/curriculum/challenges/english/blocks/workshop-bill-splitter/6977a4306bb3e856690a4890.md index 0292d455950..f60c3c9123a 100644 --- a/curriculum/challenges/english/blocks/workshop-bill-splitter/6977a4306bb3e856690a4890.md +++ b/curriculum/challenges/english/blocks/workshop-bill-splitter/6977a4306bb3e856690a4890.md @@ -48,7 +48,7 @@ main_courses = 57.34 desserts = 39.39 drinks = 64.21 -running_total = appetizers + main_courses + desserts + drinks +running_total += appetizers + main_courses + desserts + drinks print('Total bill so far:', running_total) tip = running_total * 0.25 diff --git a/curriculum/challenges/english/blocks/workshop-bill-splitter/6977a8bbcbdd557886bd0718.md b/curriculum/challenges/english/blocks/workshop-bill-splitter/6977a8bbcbdd557886bd0718.md index 93f225a0587..e3872f10957 100644 --- a/curriculum/challenges/english/blocks/workshop-bill-splitter/6977a8bbcbdd557886bd0718.md +++ b/curriculum/challenges/english/blocks/workshop-bill-splitter/6977a8bbcbdd557886bd0718.md @@ -64,7 +64,7 @@ main_courses = 57.34 desserts = 39.39 drinks = 64.21 -running_total = appetizers + main_courses + desserts + drinks +running_total += appetizers + main_courses + desserts + drinks print('Total bill so far:', running_total) tip = running_total * 0.25 diff --git a/curriculum/challenges/english/blocks/workshop-bill-splitter/697a7f71ebfcd9e4cacd69c2.md b/curriculum/challenges/english/blocks/workshop-bill-splitter/697a7f71ebfcd9e4cacd69c2.md index 53b46ad008a..534f0eb805d 100644 --- a/curriculum/challenges/english/blocks/workshop-bill-splitter/697a7f71ebfcd9e4cacd69c2.md +++ b/curriculum/challenges/english/blocks/workshop-bill-splitter/697a7f71ebfcd9e4cacd69c2.md @@ -67,7 +67,7 @@ main_courses = 57.34 desserts = 39.39 drinks = 64.21 -running_total = appetizers + main_courses + desserts + drinks +running_total += appetizers + main_courses + desserts + drinks print('Total bill so far:', running_total) tip = running_total * 0.25 @@ -96,7 +96,7 @@ main_courses = 57.34 desserts = 39.39 drinks = 64.21 -running_total = appetizers + main_courses + desserts + drinks +running_total += appetizers + main_courses + desserts + drinks print('Total bill so far:', running_total) tip = running_total * 0.25 diff --git a/curriculum/challenges/english/blocks/workshop-bill-splitter/6982684f3a25f379e195a5fc.md b/curriculum/challenges/english/blocks/workshop-bill-splitter/6982684f3a25f379e195a5fc.md index 3dbf23543f2..c9321f9371d 100644 --- a/curriculum/challenges/english/blocks/workshop-bill-splitter/6982684f3a25f379e195a5fc.md +++ b/curriculum/challenges/english/blocks/workshop-bill-splitter/6982684f3a25f379e195a5fc.md @@ -9,7 +9,15 @@ dashedName: step-4 Now that you have stored the individual costs, you can calculate the total. In Python, you use the addition operator `+` to sum values together. -Update the `running_total` variable by adding `appetizers`, `main_courses`, `desserts`, and `drinks` together. +The `+=` operator adds a value to an existing variable and updates it at the same time. For example: + +```py +total = 10 +total += 2 + 2 + 1 +print(total) # total is now 15 +``` + +Use the `+=` operator once to add `appetizers`, `main_courses`, `desserts`, and `drinks` to `running_total`. Finally, use `print()` to display the string `Total bill so far:` followed by a space and the value of `running_total`. @@ -17,7 +25,7 @@ Finally, use `print()` to display the string `Total bill so far:` followed by a # --hints-- -You should update `running_total` using the `+` operator to sum all four courses cost. +You should update `running_total` using the `+=` operator once to add all four course costs. ```js ({ @@ -25,7 +33,7 @@ You should update `running_total` using the `+` operator to sum all four courses import itertools perms = itertools.permutations(['+ appetizers', '+ main_courses', '+ desserts', '+ drinks']) values = (' '.join(perm).lstrip('+') for perm in perms) -solutions = (f'running_total = {v}' for v in values) +solutions = (f'running_total += {v}' for v in values) assert any(_Node(_code).has_stmt(s) for s in solutions)`) }) ```