mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-09-24 23:01:18 +08:00
fix(curriculum): acknowledge tracebacks in cipher project (#54724)
Co-authored-by: Dario-DC <105294544+Dario-DC@users.noreply.github.com>
This commit is contained in:
+70
-78
@@ -107,292 +107,284 @@
|
||||
"title": "Step 24"
|
||||
},
|
||||
{
|
||||
"id": "656883980318048fb11a6e3b",
|
||||
"id": "656886ec4e4d9b96ded3c565",
|
||||
"title": "Step 25"
|
||||
},
|
||||
{
|
||||
"id": "656884439d4d7d929d58669d",
|
||||
"id": "65521fc818947e800bffe48a",
|
||||
"title": "Step 26"
|
||||
},
|
||||
{
|
||||
"id": "656886ec4e4d9b96ded3c565",
|
||||
"id": "655220953ba90d80514d7ee2",
|
||||
"title": "Step 27"
|
||||
},
|
||||
{
|
||||
"id": "65521fc818947e800bffe48a",
|
||||
"id": "65524d2a1a253b8bb5197ae2",
|
||||
"title": "Step 28"
|
||||
},
|
||||
{
|
||||
"id": "655220953ba90d80514d7ee2",
|
||||
"id": "65522255d5b9cd80f335c6f2",
|
||||
"title": "Step 29"
|
||||
},
|
||||
{
|
||||
"id": "65524d2a1a253b8bb5197ae2",
|
||||
"id": "65688a50e6c998a21d8e41d3",
|
||||
"title": "Step 30"
|
||||
},
|
||||
{
|
||||
"id": "65522255d5b9cd80f335c6f2",
|
||||
"id": "65688b5a1655a7a6caede847",
|
||||
"title": "Step 31"
|
||||
},
|
||||
{
|
||||
"id": "65688a50e6c998a21d8e41d3",
|
||||
"id": "6568b7a40c7ba0ccbc4b4425",
|
||||
"title": "Step 32"
|
||||
},
|
||||
{
|
||||
"id": "65688b5a1655a7a6caede847",
|
||||
"id": "6552487e689f6e895f658717",
|
||||
"title": "Step 33"
|
||||
},
|
||||
{
|
||||
"id": "6568b7a40c7ba0ccbc4b4425",
|
||||
"id": "65524b3aa6a1938a069a91ab",
|
||||
"title": "Step 34"
|
||||
},
|
||||
{
|
||||
"id": "6552487e689f6e895f658717",
|
||||
"id": "65524b790ba8558a2f1c9fe5",
|
||||
"title": "Step 35"
|
||||
},
|
||||
{
|
||||
"id": "65524b3aa6a1938a069a91ab",
|
||||
"id": "655251308f31958d06cdf267",
|
||||
"title": "Step 36"
|
||||
},
|
||||
{
|
||||
"id": "65524b790ba8558a2f1c9fe5",
|
||||
"id": "6568cc9301a0c41058ed95c5",
|
||||
"title": "Step 37"
|
||||
},
|
||||
{
|
||||
"id": "655251308f31958d06cdf267",
|
||||
"id": "6568c86dc9193000d11ca5e0",
|
||||
"title": "Step 38"
|
||||
},
|
||||
{
|
||||
"id": "6568cc9301a0c41058ed95c5",
|
||||
"id": "65525e359ca28d938baa82c5",
|
||||
"title": "Step 39"
|
||||
},
|
||||
{
|
||||
"id": "6568c86dc9193000d11ca5e0",
|
||||
"id": "655a2a7210094920069b117c",
|
||||
"title": "Step 40"
|
||||
},
|
||||
{
|
||||
"id": "65525e359ca28d938baa82c5",
|
||||
"id": "655261b2e1f2c197093f3993",
|
||||
"title": "Step 41"
|
||||
},
|
||||
{
|
||||
"id": "655a2a7210094920069b117c",
|
||||
"id": "6553980e0527fa115c705646",
|
||||
"title": "Step 42"
|
||||
},
|
||||
{
|
||||
"id": "655261b2e1f2c197093f3993",
|
||||
"id": "6553995f412dd8122ed38e4a",
|
||||
"title": "Step 43"
|
||||
},
|
||||
{
|
||||
"id": "6553980e0527fa115c705646",
|
||||
"id": "6553a755879b131a445e664c",
|
||||
"title": "Step 44"
|
||||
},
|
||||
{
|
||||
"id": "6553995f412dd8122ed38e4a",
|
||||
"id": "6553a7d8d05cbb1ae335a665",
|
||||
"title": "Step 45"
|
||||
},
|
||||
{
|
||||
"id": "6553a755879b131a445e664c",
|
||||
"id": "655619327c7b364166f8dd6f",
|
||||
"title": "Step 46"
|
||||
},
|
||||
{
|
||||
"id": "6553a7d8d05cbb1ae335a665",
|
||||
"id": "6553a44b1801991847d8cc69",
|
||||
"title": "Step 47"
|
||||
},
|
||||
{
|
||||
"id": "655619327c7b364166f8dd6f",
|
||||
"id": "6553f6b4ec51112d44d737c8",
|
||||
"title": "Step 48"
|
||||
},
|
||||
{
|
||||
"id": "6553a44b1801991847d8cc69",
|
||||
"id": "6553a572f7a65718f1e42e18",
|
||||
"title": "Step 49"
|
||||
},
|
||||
{
|
||||
"id": "6553f6b4ec51112d44d737c8",
|
||||
"id": "6553ed69ece88d29594748aa",
|
||||
"title": "Step 50"
|
||||
},
|
||||
{
|
||||
"id": "6553a572f7a65718f1e42e18",
|
||||
"id": "6553efd6ada3f42aa2d75448",
|
||||
"title": "Step 51"
|
||||
},
|
||||
{
|
||||
"id": "6553ed69ece88d29594748aa",
|
||||
"id": "6553f3fc92741c2bf8ded140",
|
||||
"title": "Step 52"
|
||||
},
|
||||
{
|
||||
"id": "6553efd6ada3f42aa2d75448",
|
||||
"id": "6553f4f66099802c6ae94613",
|
||||
"title": "Step 53"
|
||||
},
|
||||
{
|
||||
"id": "6553f3fc92741c2bf8ded140",
|
||||
"id": "6553f6086add4b2cbb99fd78",
|
||||
"title": "Step 54"
|
||||
},
|
||||
{
|
||||
"id": "6553f4f66099802c6ae94613",
|
||||
"id": "6553f8c570f9982e013a8886",
|
||||
"title": "Step 55"
|
||||
},
|
||||
{
|
||||
"id": "6553f6086add4b2cbb99fd78",
|
||||
"id": "655491bd5b98b813fa5bedca",
|
||||
"title": "Step 56"
|
||||
},
|
||||
{
|
||||
"id": "6553f8c570f9982e013a8886",
|
||||
"id": "6554930320d70414e7b6acc6",
|
||||
"title": "Step 57"
|
||||
},
|
||||
{
|
||||
"id": "655491bd5b98b813fa5bedca",
|
||||
"id": "65549561463f0016876e852c",
|
||||
"title": "Step 58"
|
||||
},
|
||||
{
|
||||
"id": "6554930320d70414e7b6acc6",
|
||||
"id": "65549f90cf78131c96ebcf28",
|
||||
"title": "Step 59"
|
||||
},
|
||||
{
|
||||
"id": "65549561463f0016876e852c",
|
||||
"id": "6554a334a40edb1fb4eff827",
|
||||
"title": "Step 60"
|
||||
},
|
||||
{
|
||||
"id": "65549f90cf78131c96ebcf28",
|
||||
"id": "6554a49a4f782f208abcc87e",
|
||||
"title": "Step 61"
|
||||
},
|
||||
{
|
||||
"id": "6554a334a40edb1fb4eff827",
|
||||
"id": "6554a57ec0a2c52106e7ee50",
|
||||
"title": "Step 62"
|
||||
},
|
||||
{
|
||||
"id": "6554a49a4f782f208abcc87e",
|
||||
"id": "6554a88d5af937226f4a9121",
|
||||
"title": "Step 63"
|
||||
},
|
||||
{
|
||||
"id": "6554a57ec0a2c52106e7ee50",
|
||||
"id": "6554ac937a49be2701af4f2f",
|
||||
"title": "Step 64"
|
||||
},
|
||||
{
|
||||
"id": "6554a88d5af937226f4a9121",
|
||||
"id": "6554ad2463b8892748f8efdd",
|
||||
"title": "Step 65"
|
||||
},
|
||||
{
|
||||
"id": "6554ac937a49be2701af4f2f",
|
||||
"id": "6554d0332949b133a0b35eaa",
|
||||
"title": "Step 66"
|
||||
},
|
||||
{
|
||||
"id": "6554ad2463b8892748f8efdd",
|
||||
"id": "6554d15c8acb5f34499ad789",
|
||||
"title": "Step 67"
|
||||
},
|
||||
{
|
||||
"id": "6554d0332949b133a0b35eaa",
|
||||
"id": "6554d25dc5ceaa354307a77e",
|
||||
"title": "Step 68"
|
||||
},
|
||||
{
|
||||
"id": "6554d15c8acb5f34499ad789",
|
||||
"id": "6554de295ade563a069936a1",
|
||||
"title": "Step 69"
|
||||
},
|
||||
{
|
||||
"id": "6554d25dc5ceaa354307a77e",
|
||||
"id": "6554dfce1683be3c0c9609a6",
|
||||
"title": "Step 70"
|
||||
},
|
||||
{
|
||||
"id": "6554de295ade563a069936a1",
|
||||
"id": "6554e0adc7bb193cbfdb36d5",
|
||||
"title": "Step 71"
|
||||
},
|
||||
{
|
||||
"id": "6554dfce1683be3c0c9609a6",
|
||||
"id": "6554e2ee23bfd93f2c83640f",
|
||||
"title": "Step 72"
|
||||
},
|
||||
{
|
||||
"id": "6554e0adc7bb193cbfdb36d5",
|
||||
"id": "6554e343caea913ffba7bec6",
|
||||
"title": "Step 73"
|
||||
},
|
||||
{
|
||||
"id": "6554e2ee23bfd93f2c83640f",
|
||||
"id": "655516e410b8e30fb4fb64e8",
|
||||
"title": "Step 74"
|
||||
},
|
||||
{
|
||||
"id": "6554e343caea913ffba7bec6",
|
||||
"id": "6555d6e12c95701172b55709",
|
||||
"title": "Step 75"
|
||||
},
|
||||
{
|
||||
"id": "655516e410b8e30fb4fb64e8",
|
||||
"id": "6555d8b0b3d20b128bdadd37",
|
||||
"title": "Step 76"
|
||||
},
|
||||
{
|
||||
"id": "6555d6e12c95701172b55709",
|
||||
"id": "65551a628bcb7e121e32d04b",
|
||||
"title": "Step 77"
|
||||
},
|
||||
{
|
||||
"id": "6555d8b0b3d20b128bdadd37",
|
||||
"id": "6555201d9b7fc917399f9f0b",
|
||||
"title": "Step 78"
|
||||
},
|
||||
{
|
||||
"id": "65551a628bcb7e121e32d04b",
|
||||
"id": "655520c20cb1e6177b0641d6",
|
||||
"title": "Step 79"
|
||||
},
|
||||
{
|
||||
"id": "6555201d9b7fc917399f9f0b",
|
||||
"id": "655522883e66f618e03a9411",
|
||||
"title": "Step 80"
|
||||
},
|
||||
{
|
||||
"id": "655520c20cb1e6177b0641d6",
|
||||
"id": "6555231eac4d9f19bd3d44b5",
|
||||
"title": "Step 81"
|
||||
},
|
||||
{
|
||||
"id": "655522883e66f618e03a9411",
|
||||
"id": "65552a111190e11f0963949e",
|
||||
"title": "Step 82"
|
||||
},
|
||||
{
|
||||
"id": "6555231eac4d9f19bd3d44b5",
|
||||
"id": "65552a9593755e1fb2f5ab50",
|
||||
"title": "Step 83"
|
||||
},
|
||||
{
|
||||
"id": "65552a111190e11f0963949e",
|
||||
"id": "65552b14e803731fe3c1e4ca",
|
||||
"title": "Step 84"
|
||||
},
|
||||
{
|
||||
"id": "65552a9593755e1fb2f5ab50",
|
||||
"id": "65553159615a8123b190ee43",
|
||||
"title": "Step 85"
|
||||
},
|
||||
{
|
||||
"id": "65552b14e803731fe3c1e4ca",
|
||||
"id": "65a450e8fb2c9d75c7378d28",
|
||||
"title": "Step 86"
|
||||
},
|
||||
{
|
||||
"id": "65553159615a8123b190ee43",
|
||||
"id": "6555db4a7b788e15795674e5",
|
||||
"title": "Step 87"
|
||||
},
|
||||
{
|
||||
"id": "65a450e8fb2c9d75c7378d28",
|
||||
"id": "6555df0c81300b175308557d",
|
||||
"title": "Step 88"
|
||||
},
|
||||
{
|
||||
"id": "6555db4a7b788e15795674e5",
|
||||
"id": "6555e1bfcd374e18c6be8e58",
|
||||
"title": "Step 89"
|
||||
},
|
||||
{
|
||||
"id": "6555df0c81300b175308557d",
|
||||
"id": "6555e3f387381a19d5e00333",
|
||||
"title": "Step 90"
|
||||
},
|
||||
{
|
||||
"id": "6555e1bfcd374e18c6be8e58",
|
||||
"id": "6555e43e783ed31a0532b1b2",
|
||||
"title": "Step 91"
|
||||
},
|
||||
{
|
||||
"id": "6555e3f387381a19d5e00333",
|
||||
"id": "65a51c9e000b660122b8b29e",
|
||||
"title": "Step 92"
|
||||
},
|
||||
{
|
||||
"id": "6555e43e783ed31a0532b1b2",
|
||||
"id": "6555e547c18a2b1a7b795bd8",
|
||||
"title": "Step 93"
|
||||
},
|
||||
{
|
||||
"id": "65a51c9e000b660122b8b29e",
|
||||
"title": "Step 94"
|
||||
},
|
||||
{
|
||||
"id": "6555e547c18a2b1a7b795bd8",
|
||||
"title": "Step 95"
|
||||
},
|
||||
{
|
||||
"id": "6555e5991af57d1ae0e35f0a",
|
||||
"title": "Step 96"
|
||||
"title": "Step 94"
|
||||
}
|
||||
],
|
||||
"helpCategory": "Python"
|
||||
|
||||
+2
@@ -19,6 +19,8 @@ for i in text:
|
||||
|
||||
Below the line where you declared `alphabet`, write a `for` loop to iterate over `text`. Use `i` as the loop variable.
|
||||
|
||||
Doing so, there is an error in the terminal. You will learn about it in the next step.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should use the `for` keyword to create a loop. Make sure to place the `for` keyword at the beginning of the line and leave a white space after the keyword.
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65521fc818947e800bffe48a
|
||||
title: Step 28
|
||||
title: Step 26
|
||||
challengeType: 20
|
||||
dashedName: step-28
|
||||
dashedName: step-26
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 655220953ba90d80514d7ee2
|
||||
title: Step 29
|
||||
title: Step 27
|
||||
challengeType: 20
|
||||
dashedName: step-29
|
||||
dashedName: step-27
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65522255d5b9cd80f335c6f2
|
||||
title: Step 31
|
||||
title: Step 29
|
||||
challengeType: 20
|
||||
dashedName: step-31
|
||||
dashedName: step-29
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6552487e689f6e895f658717
|
||||
title: Step 35
|
||||
title: Step 33
|
||||
challengeType: 20
|
||||
dashedName: step-35
|
||||
dashedName: step-33
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65524b3aa6a1938a069a91ab
|
||||
title: Step 36
|
||||
title: Step 34
|
||||
challengeType: 20
|
||||
dashedName: step-36
|
||||
dashedName: step-34
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65524b790ba8558a2f1c9fe5
|
||||
title: Step 37
|
||||
title: Step 35
|
||||
challengeType: 20
|
||||
dashedName: step-37
|
||||
dashedName: step-35
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65524d2a1a253b8bb5197ae2
|
||||
title: Step 30
|
||||
title: Step 28
|
||||
challengeType: 20
|
||||
dashedName: step-30
|
||||
dashedName: step-28
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 655251308f31958d06cdf267
|
||||
title: Step 38
|
||||
title: Step 36
|
||||
challengeType: 20
|
||||
dashedName: step-38
|
||||
dashedName: step-36
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65525e359ca28d938baa82c5
|
||||
title: Step 41
|
||||
title: Step 39
|
||||
challengeType: 20
|
||||
dashedName: step-41
|
||||
dashedName: step-39
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 655261b2e1f2c197093f3993
|
||||
title: Step 43
|
||||
title: Step 41
|
||||
challengeType: 20
|
||||
dashedName: step-43
|
||||
dashedName: step-41
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6553980e0527fa115c705646
|
||||
title: Step 44
|
||||
title: Step 42
|
||||
challengeType: 20
|
||||
dashedName: step-44
|
||||
dashedName: step-42
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6553995f412dd8122ed38e4a
|
||||
title: Step 45
|
||||
title: Step 43
|
||||
challengeType: 20
|
||||
dashedName: step-45
|
||||
dashedName: step-43
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6553a44b1801991847d8cc69
|
||||
title: Step 49
|
||||
title: Step 47
|
||||
challengeType: 20
|
||||
dashedName: step-49
|
||||
dashedName: step-47
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6553a572f7a65718f1e42e18
|
||||
title: Step 51
|
||||
title: Step 49
|
||||
challengeType: 20
|
||||
dashedName: step-51
|
||||
dashedName: step-49
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+5
-3
@@ -1,13 +1,15 @@
|
||||
---
|
||||
id: 6553a755879b131a445e664c
|
||||
title: Step 46
|
||||
title: Step 44
|
||||
challengeType: 20
|
||||
dashedName: step-46
|
||||
dashedName: step-44
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Try to assign the string `'Hello Zaira'` to your `text` variable and see what happens in the console.
|
||||
Try to assign the string `'Hello Zaira'` to your `text` variable and see what happens in the terminal.
|
||||
|
||||
You'll see a `string index out of range` exception. Don't worry, you'll figure out how to fix it soon!
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+5
-3
@@ -1,13 +1,15 @@
|
||||
---
|
||||
id: 6553a7d8d05cbb1ae335a665
|
||||
title: Step 47
|
||||
title: Step 45
|
||||
challengeType: 20
|
||||
dashedName: step-47
|
||||
dashedName: step-45
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
When the loop reaches the letter `Z`, the sum `index + shift` exceeds the length of the string `alphabet`.
|
||||
When the loop reaches the letter `Z`, the sum `index + shift` exceeds the last index of the string `alphabet`. Therefore, `alphabet[new_index]` is trying to use an invalid index, which causes an `IndexError` to be thrown.
|
||||
|
||||
You can notice that the output in the terminal stops at the space immediately before the `Z`, the last `print` before the error is thrown.
|
||||
|
||||
In this case, the modulo operator (`%`) can be used to return the remainder of the division between two numbers. For example: `5 % 2` is equal to `1`, because 5 divided by 2 has a quotient of 2 and a remainder of 1.
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6553ed69ece88d29594748aa
|
||||
title: Step 52
|
||||
title: Step 50
|
||||
challengeType: 20
|
||||
dashedName: step-52
|
||||
dashedName: step-50
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+14
-4
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6553efd6ada3f42aa2d75448
|
||||
title: Step 53
|
||||
title: Step 51
|
||||
challengeType: 20
|
||||
dashedName: step-53
|
||||
dashedName: step-51
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -16,10 +16,20 @@ def function_name(param_1, param_2):
|
||||
|
||||
Parameters are variables that you can use inside your function. A function can be declared with different number of parameters. In the example above, `param_1` and `param_2` are parameters.
|
||||
|
||||
Modify your function declaration so that it takes two parameters called `message` and `offset`.
|
||||
Modify your function declaration so that it takes two parameters called message and offset.
|
||||
|
||||
After that, you'll see an error appear in the terminal. As a temporary fix, comment out the `caesar()` call.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should comment out the `caesar()` function call.
|
||||
|
||||
```js
|
||||
({test: () => assert(runPython(
|
||||
`not _Node(_code).find_calls('caesar')`
|
||||
))})
|
||||
```
|
||||
|
||||
Your `caesar` function should take `message` and `offset` as the parameters. Remember to separate the parameters with a comma.
|
||||
|
||||
```js
|
||||
@@ -35,7 +45,6 @@ text = 'Hello Zaira'
|
||||
shift = 3
|
||||
--fcc-editable-region--
|
||||
def caesar():
|
||||
--fcc-editable-region--
|
||||
alphabet = 'abcdefghijklmnopqrstuvwxyz'
|
||||
encrypted_text = ''
|
||||
|
||||
@@ -50,4 +59,5 @@ def caesar():
|
||||
print('encrypted text:', encrypted_text)
|
||||
|
||||
caesar()
|
||||
--fcc-editable-region--
|
||||
```
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6553f3fc92741c2bf8ded140
|
||||
title: Step 54
|
||||
title: Step 52
|
||||
challengeType: 20
|
||||
dashedName: step-54
|
||||
dashedName: step-52
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -46,6 +46,6 @@ def caesar(message, offset):
|
||||
print('plain text:', text)
|
||||
print('encrypted text:', encrypted_text)
|
||||
|
||||
caesar()
|
||||
#caesar()
|
||||
--fcc-editable-region--
|
||||
```
|
||||
|
||||
+11
-11
@@ -1,13 +1,15 @@
|
||||
---
|
||||
id: 6553f4f66099802c6ae94613
|
||||
title: Step 55
|
||||
title: Step 53
|
||||
challengeType: 20
|
||||
dashedName: step-55
|
||||
dashedName: step-53
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Right now, your code can't execute because the `caesar` function is defined with two parameters (`message` and `offset`) but it is called without *arguments*.
|
||||
Now, uncomment your `caesar()` call. You'll see that your code raises a `TypeError`, because the `caesar` function is defined with two parameters (`message` and `offset`), therefore it expects to be called with two *arguments*.
|
||||
|
||||
Calling `caesar()` without the required arguments stops the execution of the code.
|
||||
|
||||
Give `message` and `offset` values, by passing `text` and `shift` as arguments to the `caesar` function call.
|
||||
|
||||
@@ -16,13 +18,11 @@ Give `message` and `offset` values, by passing `text` and `shift` as arguments t
|
||||
You should pass `text` and `shift` as the arguments to your function call by including them inside the parentheses. Don't forget to separate the arguments with a comma.
|
||||
|
||||
```js
|
||||
assert.match(code, /^caesar\s*\(\s*text\s*,\s*shift\s*\)/m)
|
||||
```
|
||||
|
||||
Your code contains invalid syntax and/or invalid indentation.
|
||||
|
||||
```js
|
||||
({test: () => assert(true) })
|
||||
({
|
||||
test: () => assert(runPython(
|
||||
`_Node(_code).find_calls('caesar')[0].is_equivalent('caesar(text, shift)')`
|
||||
))
|
||||
})
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -47,6 +47,6 @@ def caesar(message, offset):
|
||||
print('plain text:', message)
|
||||
print('encrypted text:', encrypted_text)
|
||||
--fcc-editable-region--
|
||||
caesar()
|
||||
# caesar()
|
||||
--fcc-editable-region--
|
||||
```
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6553f6086add4b2cbb99fd78
|
||||
title: Step 56
|
||||
title: Step 54
|
||||
challengeType: 20
|
||||
dashedName: step-56
|
||||
dashedName: step-54
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6553f6b4ec51112d44d737c8
|
||||
title: Step 50
|
||||
title: Step 48
|
||||
challengeType: 20
|
||||
dashedName: step-50
|
||||
dashedName: step-48
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6553f8c570f9982e013a8886
|
||||
title: Step 57
|
||||
title: Step 55
|
||||
challengeType: 20
|
||||
dashedName: step-57
|
||||
dashedName: step-55
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 655491bd5b98b813fa5bedca
|
||||
title: Step 58
|
||||
title: Step 56
|
||||
challengeType: 20
|
||||
dashedName: step-58
|
||||
dashedName: step-56
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554930320d70414e7b6acc6
|
||||
title: Step 59
|
||||
title: Step 57
|
||||
challengeType: 20
|
||||
dashedName: step-59
|
||||
dashedName: step-57
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65549561463f0016876e852c
|
||||
title: Step 60
|
||||
title: Step 58
|
||||
challengeType: 20
|
||||
dashedName: step-60
|
||||
dashedName: step-58
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65549f90cf78131c96ebcf28
|
||||
title: Step 61
|
||||
title: Step 59
|
||||
challengeType: 20
|
||||
dashedName: step-61
|
||||
dashedName: step-59
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554a334a40edb1fb4eff827
|
||||
title: Step 62
|
||||
title: Step 60
|
||||
challengeType: 20
|
||||
dashedName: step-62
|
||||
dashedName: step-60
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554a49a4f782f208abcc87e
|
||||
title: Step 63
|
||||
title: Step 61
|
||||
challengeType: 20
|
||||
dashedName: step-63
|
||||
dashedName: step-61
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554a57ec0a2c52106e7ee50
|
||||
title: Step 64
|
||||
title: Step 62
|
||||
challengeType: 20
|
||||
dashedName: step-64
|
||||
dashedName: step-62
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554a88d5af937226f4a9121
|
||||
title: Step 65
|
||||
title: Step 63
|
||||
challengeType: 20
|
||||
dashedName: step-65
|
||||
dashedName: step-63
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554ac937a49be2701af4f2f
|
||||
title: Step 66
|
||||
title: Step 64
|
||||
challengeType: 20
|
||||
dashedName: step-66
|
||||
dashedName: step-64
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554ad2463b8892748f8efdd
|
||||
title: Step 67
|
||||
title: Step 65
|
||||
challengeType: 20
|
||||
dashedName: step-67
|
||||
dashedName: step-65
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554d0332949b133a0b35eaa
|
||||
title: Step 68
|
||||
title: Step 66
|
||||
challengeType: 20
|
||||
dashedName: step-68
|
||||
dashedName: step-66
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554d15c8acb5f34499ad789
|
||||
title: Step 69
|
||||
title: Step 67
|
||||
challengeType: 20
|
||||
dashedName: step-69
|
||||
dashedName: step-67
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554d25dc5ceaa354307a77e
|
||||
title: Step 70
|
||||
title: Step 68
|
||||
challengeType: 20
|
||||
dashedName: step-70
|
||||
dashedName: step-68
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554de295ade563a069936a1
|
||||
title: Step 71
|
||||
title: Step 69
|
||||
challengeType: 20
|
||||
dashedName: step-71
|
||||
dashedName: step-69
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554dfce1683be3c0c9609a6
|
||||
title: Step 72
|
||||
title: Step 70
|
||||
challengeType: 20
|
||||
dashedName: step-72
|
||||
dashedName: step-70
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554e0adc7bb193cbfdb36d5
|
||||
title: Step 73
|
||||
title: Step 71
|
||||
challengeType: 20
|
||||
dashedName: step-73
|
||||
dashedName: step-71
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554e2ee23bfd93f2c83640f
|
||||
title: Step 74
|
||||
title: Step 72
|
||||
challengeType: 20
|
||||
dashedName: step-74
|
||||
dashedName: step-72
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6554e343caea913ffba7bec6
|
||||
title: Step 75
|
||||
title: Step 73
|
||||
challengeType: 20
|
||||
dashedName: step-75
|
||||
dashedName: step-73
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 655516e410b8e30fb4fb64e8
|
||||
title: Step 76
|
||||
title: Step 74
|
||||
challengeType: 20
|
||||
dashedName: step-76
|
||||
dashedName: step-74
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65551a628bcb7e121e32d04b
|
||||
title: Step 79
|
||||
title: Step 77
|
||||
challengeType: 20
|
||||
dashedName: step-79
|
||||
dashedName: step-77
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6555201d9b7fc917399f9f0b
|
||||
title: Step 80
|
||||
title: Step 78
|
||||
challengeType: 20
|
||||
dashedName: step-80
|
||||
dashedName: step-78
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 655520c20cb1e6177b0641d6
|
||||
title: Step 81
|
||||
title: Step 79
|
||||
challengeType: 20
|
||||
dashedName: step-81
|
||||
dashedName: step-79
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 655522883e66f618e03a9411
|
||||
title: Step 82
|
||||
title: Step 80
|
||||
challengeType: 20
|
||||
dashedName: step-82
|
||||
dashedName: step-80
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6555231eac4d9f19bd3d44b5
|
||||
title: Step 83
|
||||
title: Step 81
|
||||
challengeType: 20
|
||||
dashedName: step-83
|
||||
dashedName: step-81
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65552a111190e11f0963949e
|
||||
title: Step 84
|
||||
title: Step 82
|
||||
challengeType: 20
|
||||
dashedName: step-84
|
||||
dashedName: step-82
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65552a9593755e1fb2f5ab50
|
||||
title: Step 85
|
||||
title: Step 83
|
||||
challengeType: 20
|
||||
dashedName: step-85
|
||||
dashedName: step-83
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65552b14e803731fe3c1e4ca
|
||||
title: Step 86
|
||||
title: Step 84
|
||||
challengeType: 20
|
||||
dashedName: step-86
|
||||
dashedName: step-84
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65553159615a8123b190ee43
|
||||
title: Step 87
|
||||
title: Step 85
|
||||
challengeType: 20
|
||||
dashedName: step-87
|
||||
dashedName: step-85
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6555d6e12c95701172b55709
|
||||
title: Step 77
|
||||
title: Step 75
|
||||
challengeType: 20
|
||||
dashedName: step-77
|
||||
dashedName: step-75
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6555d8b0b3d20b128bdadd37
|
||||
title: Step 78
|
||||
title: Step 76
|
||||
challengeType: 20
|
||||
dashedName: step-78
|
||||
dashedName: step-76
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6555db4a7b788e15795674e5
|
||||
title: Step 89
|
||||
title: Step 87
|
||||
challengeType: 20
|
||||
dashedName: step-89
|
||||
dashedName: step-87
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6555df0c81300b175308557d
|
||||
title: Step 90
|
||||
title: Step 88
|
||||
challengeType: 20
|
||||
dashedName: step-90
|
||||
dashedName: step-88
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6555e1bfcd374e18c6be8e58
|
||||
title: Step 91
|
||||
title: Step 89
|
||||
challengeType: 20
|
||||
dashedName: step-91
|
||||
dashedName: step-89
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6555e3f387381a19d5e00333
|
||||
title: Step 92
|
||||
title: Step 90
|
||||
challengeType: 20
|
||||
dashedName: step-92
|
||||
dashedName: step-90
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6555e43e783ed31a0532b1b2
|
||||
title: Step 93
|
||||
title: Step 91
|
||||
challengeType: 20
|
||||
dashedName: step-93
|
||||
dashedName: step-91
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6555e547c18a2b1a7b795bd8
|
||||
title: Step 95
|
||||
title: Step 93
|
||||
challengeType: 20
|
||||
dashedName: step-95
|
||||
dashedName: step-93
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6555e5991af57d1ae0e35f0a
|
||||
title: Step 96
|
||||
title: Step 94
|
||||
challengeType: 20
|
||||
dashedName: step-96
|
||||
dashedName: step-94
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 655619327c7b364166f8dd6f
|
||||
title: Step 48
|
||||
title: Step 46
|
||||
challengeType: 20
|
||||
dashedName: step-48
|
||||
dashedName: step-46
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 655a2a7210094920069b117c
|
||||
title: Step 42
|
||||
title: Step 40
|
||||
challengeType: 20
|
||||
dashedName: step-42
|
||||
dashedName: step-40
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+9
@@ -14,6 +14,15 @@ for i in text:
|
||||
print(i)
|
||||
```
|
||||
|
||||
Python relies on indentation to indicate blocks of code. A colon at the end of a line is a signal that a new indented block of code will follow.
|
||||
|
||||
So, when no indented block is found after the final colon, the code execution stops and an `IndentationError` is thrown. This code will not show the output and instead raise an `IndentationError`:
|
||||
|
||||
```py
|
||||
for i in text:
|
||||
print(i)
|
||||
```
|
||||
|
||||
Give your `for` loop a body by adding a call to `print(i)`. Remember to indent the loop body.
|
||||
|
||||
# --hints--
|
||||
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
---
|
||||
id: 656883980318048fb11a6e3b
|
||||
title: Step 25
|
||||
challengeType: 20
|
||||
dashedName: step-25
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Now, remove the indentation and see what happens to the output.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should remove the indentation from the line where you call `print(i)`.
|
||||
|
||||
```js
|
||||
assert.match(code, /^for\s+i\s+in\s+text:\s*^print\s*\(\s*i\s*\)/m)
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```py
|
||||
text = 'Hello World'
|
||||
shift = 3
|
||||
alphabet = 'abcdefghijklmnopqrstuvwxyz'
|
||||
--fcc-editable-region--
|
||||
for i in text:
|
||||
print(i)
|
||||
--fcc-editable-region--
|
||||
```
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
---
|
||||
id: 656884439d4d7d929d58669d
|
||||
title: Step 26
|
||||
challengeType: 20
|
||||
dashedName: step-26
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Python relies on indentation to indicate blocks of code. A colon at the end of a line is a signal that a new indented block of code will follow.
|
||||
|
||||
So, when no indented block is found after the final colon, the code execution stops and an `IndentationError` is thrown. Therefore, there's no output anymore.
|
||||
|
||||
Restore the indentation for your `print(i)` call.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should indent `print(i)` inside your `for` loop body.
|
||||
|
||||
```js
|
||||
const commentless_code = __helpers.python.removeComments(code);
|
||||
assert.match(commentless_code, /^for\s+i\s+in\s+text:\s*^\s+print\s*\(\s*i\s*\)/m)
|
||||
```
|
||||
|
||||
Your code contains invalid syntax and/or invalid indentation.
|
||||
|
||||
```js
|
||||
({test: () => assert(true) })
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```py
|
||||
text = 'Hello World'
|
||||
shift = 3
|
||||
alphabet = 'abcdefghijklmnopqrstuvwxyz'
|
||||
--fcc-editable-region--
|
||||
for i in text:
|
||||
print(i)
|
||||
--fcc-editable-region--
|
||||
```
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 656886ec4e4d9b96ded3c565
|
||||
title: Step 27
|
||||
title: Step 25
|
||||
challengeType: 20
|
||||
dashedName: step-27
|
||||
dashedName: step-25
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65688a50e6c998a21d8e41d3
|
||||
title: Step 32
|
||||
title: Step 30
|
||||
challengeType: 20
|
||||
dashedName: step-32
|
||||
dashedName: step-30
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -14,7 +14,7 @@ my_string = 'brain'
|
||||
my_string[0] = 't'
|
||||
```
|
||||
|
||||
Confirm that by using the bracket notation to access the first letter in `text` and try to change it into a character of your choice. You will see the ouput disappear.
|
||||
Confirm that by using the bracket notation to access the first letter in `text` and try to change it into a character of your choice. You will see the ouput disappear and an error appear.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+5
-3
@@ -1,13 +1,15 @@
|
||||
---
|
||||
id: 65688b5a1655a7a6caede847
|
||||
title: Step 33
|
||||
title: Step 31
|
||||
challengeType: 20
|
||||
dashedName: step-33
|
||||
dashedName: step-31
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
If you try to change the individual characters of a string as you did in the previous step, you will get a `TypeError`. However, a variable can be reassigned another string:
|
||||
When you try to change the individual characters of a string as you did in the previous step, you get a `TypeError`, which occurs when an object of inappropriate type is used in your code.
|
||||
|
||||
As you can see from the error message, strings do not support item assignment, because they are immutable. However, a variable can be reassigned another string:
|
||||
|
||||
```py
|
||||
message = 'Hello World'
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6568b7a40c7ba0ccbc4b4425
|
||||
title: Step 34
|
||||
title: Step 32
|
||||
challengeType: 20
|
||||
dashedName: step-34
|
||||
dashedName: step-32
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6568c86dc9193000d11ca5e0
|
||||
title: Step 40
|
||||
title: Step 38
|
||||
challengeType: 20
|
||||
dashedName: step-40
|
||||
dashedName: step-38
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 6568cc9301a0c41058ed95c5
|
||||
title: Step 39
|
||||
title: Step 37
|
||||
challengeType: 20
|
||||
dashedName: step-39
|
||||
dashedName: step-37
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65a450e8fb2c9d75c7378d28
|
||||
title: Step 88
|
||||
title: Step 86
|
||||
challengeType: 20
|
||||
dashedName: step-88
|
||||
dashedName: step-86
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 65a51c9e000b660122b8b29e
|
||||
title: Step 94
|
||||
title: Step 92
|
||||
challengeType: 20
|
||||
dashedName: step-94
|
||||
dashedName: step-92
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Reference in New Issue
Block a user