chore(i18n,learn): processed translations (#48693)

This commit is contained in:
camperbot
2022-12-08 09:40:53 -08:00
committed by GitHub
parent d266e5d067
commit ef5d93b67f
61 changed files with 450 additions and 450 deletions

View File

@@ -8,15 +8,15 @@ dashedName: implement-map-on-a-prototype
# --description--
كما رأيتم من تطبيق `Array.prototype.map()`، أو `map()` من قبل، فدالة `map` ترجع array من نفس طول الـ array التي استُدعت الدالة عليها. وهي إلى ذلك لا تغير القائمة (array) الأصلية، مادام أن وظيفتها لإعادة التفعيل (callback function) لا تفعل ذلك.
كما رأيتم من تطبيق `Array.prototype.map()`، أو `map()` من قبل، فطريقة `map` تنتج قائمة (array) من نفس طول القائمة (array) التي تم تفعيل الطريقة عليها. وهي إلى ذلك لا تغير القائمة (array) الأصلية، مادام أن وظيفتها لإعادة التفعيل (callback function) لا تفعل ذلك.
بمعنى آخر، `map` هي وظيفة خالصة (pure function)، ومخرجها يعتمد فقط على مدخلاتها. إضافةً إلى ذلك، فإنها تأخذ وظيفة أخرى كحجة (argument) لها.
بمعنى آخر، `map` هي وظيفة خالصة (pure function)، ومخرجها يعتمد فقط على مدخلاتها. إضافةً إلى ذلك، فإنها تأخذ وظيفة أخرى كوسيط (argument) لها.
قد تتعلم الكثير عن دالة `map` إذا قمت بتنفيذ الإصدار الخاص بك منها. من المستحسن أن تستخدم حلقات `for` التكرارية أو `Array.prototype.forEach()`.
قد تتعلم الكثير عن طريقة `map` إذا مارست نسختك منها. من المستحسن أن تستخدم حلقات `for` التكرارية أو `Array.prototype.forEach()`.
# --instructions--
اكتب `Array.prototype.myMap()` الخاص بك، والذي يجب أن يتصرف مثل `Array.prototype.map()`. يجب ألا تستخدم دالة `map` المدمجة. يمكن الوصول إلى مثيل (instance) `Array` في دالة `myMap` باستخدام `this`.
اكتب `Array.prototype.myMap()` الخاص بك، والذي يجب أن يتصرف مثل `Array.prototype.map()`. يجب ألا تستخدم طريقة `map` مبنية داخلياً (built-in method). يمكن الوصول إلى مثيل (instance) `Array` في طريقة `myMap` باستخدام `this`.
# --hints--
@@ -36,7 +36,7 @@ const _callback = element => element.toUpperCase();
assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_callback)));
```
`[1, 1, 2, 5, 2].myMap((element, index, array) => array[index + 1] || array[0])` should return `[1, 2, 5, 2, 1]`.
يجب أن ينتج `[1, 1, 2, 5, 2].myMap((element, index, array) => array[index + 1] || array[0])` قائمة `[1, 2, 5, 2, 1]`.
```js
const _test_s = [1, 1, 2, 5, 2];

View File

@@ -7,7 +7,7 @@ dashedName: step-75
# --description--
In some browsers, the _heart_ emoji may look slightly different from the previous step. هذا لأن بعض خصائص الشخصية قد تم تجاوزها بواسطة نمط `font-weight` من `bold`.
في بعض المتصفحات، قد يبدو رمز تعبيري _heart_ مختلفاً قليلاً عن الخطوة السابقة. هذا لأن بعض خصائص الشخصية قد تم تجاوزها بواسطة نمط `font-weight` من `bold`.
قم بإصلاح هذا، بواسطة استهداف `div` مع الرموز التعبيرية للقلب، وتعيين `font-weight` لقيمتها الأصلية.

View File

@@ -28,7 +28,7 @@ const _callback = item => item * 2;
assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_callback)));
```
`["naomi", "quincy", "camperbot"].myMap(element => element.toUpperCase())` should return `["NAOMI", "QUINCY", "CAMPERBOT"]`.
`["naomi", "quincy", "camperbot"].myMap(element => element.toUpperCase())` 應該返回 `["NAOMI", "QUINCY", "CAMPERBOT"]`
```js
const _test_s = ["naomi", "quincy", "camperbot"];
@@ -36,7 +36,7 @@ const _callback = element => element.toUpperCase();
assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_callback)));
```
`[1, 1, 2, 5, 2].myMap((element, index, array) => array[index + 1] || array[0])` should return `[1, 2, 5, 2, 1]`.
`[1, 1, 2, 5, 2].myMap((element, index, array) => array[index + 1] || array[0])` 應該返回 `[1, 2, 5, 2, 1]`
```js
const _test_s = [1, 1, 2, 5, 2];
@@ -44,7 +44,7 @@ const _callback = (element, index, array) => array[index + 1] || array[0];
assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_callback)));
```
Your code should not use the `map` method.
你的代碼不應該使用 `map` 方法。
```js
assert(!code.match(/\.?[\s\S]*?map/g));

View File

@@ -24,7 +24,7 @@ const _callback = item => item % 2;
assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFilter(_callback)));
```
`["naomi", "quincy", "camperbot"].myFilter(element => element === "naomi")` should return `["naomi"]`.
`["naomi", "quincy", "camperbot"].myFilter(element => element === "naomi")` 應該返回 `["naomi"]`
```js
const _test_s = ["naomi", "quincy", "camperbot"];
@@ -32,7 +32,7 @@ const _callback = element => element === "naomi";
assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFilter(_callback)));
```
`[1, 1, 2, 5, 2].myFilter((element, index, array) => array.indexOf(element) === index)` should return `[1, 2, 5]`.
`[1, 1, 2, 5, 2].myFilter((element, index, array) => array.indexOf(element) === index)` 應該返回 `[1, 2, 5]`
```js
const _test_s = [1, 1, 2, 5, 2];
@@ -40,7 +40,7 @@ const _callback = (element, index, array) => array.indexOf(element) === index;
assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFilter(_callback)));
```
Your code should not use the `filter` method.
你的代碼不應該使用 `filter` 方法。
```js
assert(!code.match(/\.?[\s\S]*?filter/g));

View File

@@ -14,19 +14,19 @@ dashedName: exercise-tracker
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-project-exercisetracker" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 上的初始化項目</a>來完成你的項目。
- 使用你選擇的網站生成器來完成項目。 需要包含我們 GitHub 倉庫的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit按照以下步驟設置項目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕.
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
當你完成後請將一個確保正常運行的demo項目演示託管在可以公開訪問的平臺上。 然後將 URL 提交到 `Solution Link` 中。 此外,還可以將項目的源碼提交到 `GitHub Link` 中。
# --instructions--
Your responses should have the following structures.
你的答案應該有以下結構。
Exercise:
練習:
```js
{
@@ -38,7 +38,7 @@ Exercise:
}
```
User:
用戶:
```js
{
@@ -47,7 +47,7 @@ User:
}
```
Log:
日誌:
```js
{
@@ -62,11 +62,11 @@ Log:
}
```
**Hint:** For the `date` property, the `toDateString` method of the `Date` API can be used to achieve the expected output.
**提示:** 對於 `date` 屬性,`Date` API 的 `toDateString` 方法可用於實現預期輸出。
# --hints--
You should provide your own project, not the example URL.
你應該提交你自己的項目,而不是示例 URL
```js
(getUserInput) => {
@@ -77,7 +77,7 @@ You should provide your own project, not the example URL.
};
```
You can `POST` to `/api/users` with form data `username` to create a new user.
你可以將表單裏的 `username` 通過 `POST` 請求發送到 `/api/users`,以創建一個新的用戶。
```js
async (getUserInput) => {
@@ -94,7 +94,7 @@ async (getUserInput) => {
};
```
The returned response from `POST /api/users` with form data `username` will be an object with `username` and `_id` properties.
從包含 `username``POST /api/users` 請求返回的結果將是一個包含 `username` `_id` 屬性的對象。
```js
async (getUserInput) => {
@@ -114,7 +114,7 @@ async (getUserInput) => {
};
```
You can make a `GET` request to `/api/users` to get a list of all users.
你可以向 `/api/users` 發出 `GET` 請求以獲取所有用戶的列表。
```js
async(getUserInput) => {
@@ -127,7 +127,7 @@ async(getUserInput) => {
};
```
The `GET` request to `/api/users` returns an array.
`/api/users``GET` 請求將返回一個數組。
```js
async(getUserInput) => {
@@ -142,7 +142,7 @@ async(getUserInput) => {
};
```
Each element in the array returned from `GET /api/users` is an object literal containing a user's `username` and `_id`.
`GET /api/users` 返回的數組中的每個元素都是一個對象字面量,包含用戶的 `username` `_id`
```js
async(getUserInput) => {
@@ -162,7 +162,7 @@ async(getUserInput) => {
};
```
You can `POST` to `/api/users/:_id/exercises` with form data `description`, `duration`, and optionally `date`. If no date is supplied, the current date will be used.
你可以將表單裏的 `description``duration``date`(可選)用 `POST` 發送請求到 `/api/users/:_id/exercises`。 如果沒有傳入 date默認採用當前日期。
```js
async (getUserInput) => {
@@ -196,7 +196,7 @@ async (getUserInput) => {
};
```
The response returned from `POST /api/users/:_id/exercises` will be the user object with the exercise fields added.
`POST /api/users/:_id/exercises` 返回的響應將是添加了運動字段的用戶對象。
```js
async (getUserInput) => {
@@ -235,7 +235,7 @@ async (getUserInput) => {
};
```
You can make a `GET` request to `/api/users/:_id/logs` to retrieve a full exercise log of any user.
可以發送 `GET` 請求到 `/api/users/:_id/logs`,以獲取任何用戶的完整運動日誌。
```js
async (getUserInput) => {
@@ -274,7 +274,7 @@ async (getUserInput) => {
};
```
A request to a user's log `GET /api/users/:_id/logs` returns a user object with a `count` property representing the number of exercises that belong to that user.
對用戶日誌的請求 `GET /api/users/:_id/logs` 返回一個用戶對象,該對象具有一個 `count` 屬性,表示屬於該用戶的運動次數。
```js
async (getUserInput) => {
@@ -315,7 +315,7 @@ async (getUserInput) => {
};
```
A `GET` request to `/api/users/:_id/logs` will return the user object with a `log` array of all the exercises added.
`/api/users/:_id/logs` `GET` 請求,將返回用戶對象,其中包含添加的所有練習的 `log` 數組。
```js
async(getUserInput) => {
@@ -359,7 +359,7 @@ async(getUserInput) => {
};
```
Each item in the `log` array that is returned from `GET /api/users/:_id/logs` is an object that should have a `description`, `duration`, and `date` properties.
`GET /api/users/:_id/logs` 返回的 `log` 數組中的每個項目都是一個應該具有 `description``duration` `date` 屬性的對象。
```js
async(getUserInput) => {
@@ -406,7 +406,7 @@ async(getUserInput) => {
};
```
The `description` property of any object in the `log` array that is returned from `GET /api/users/:_id/logs` should be a string.
`GET /api/users/:_id/logs` 返回的 `log` 數組中任何對象的 `description` 屬性都應該是一個字符串。
```js
async(getUserInput) => {
@@ -453,7 +453,7 @@ async(getUserInput) => {
};
```
The `duration` property of any object in the `log` array that is returned from `GET /api/users/:_id/logs` should be a number.
`GET /api/users/:_id/logs` 返回的 `log` 數組中任何對象的 `duration` 屬性應該是一個數字。
```js
async(getUserInput) => {
@@ -500,7 +500,7 @@ async(getUserInput) => {
};
```
The `date` property of any object in the `log` array that is returned from `GET /api/users/:_id/logs` should be a string. Use the `dateString` format of the `Date` API.
`GET /api/users/:_id/logs` 返回的 `log` 數組中任何對象的 `date` 屬性應該是一個字符串。 使用 `Date` API 的 `dateString` 格式。
```js
async(getUserInput) => {
@@ -547,7 +547,7 @@ async(getUserInput) => {
};
```
You can add `from`, `to` and `limit` parameters to a `GET /api/users/:_id/logs` request to retrieve part of the log of any user. `from` and `to` are dates in `yyyy-mm-dd` format. `limit` is an integer of how many logs to send back.
你可以將 `from``to` `limit` 參數添加到 `GET /api/users/:_id/logs` 請求,檢索任何用戶的部分日誌。 `from` `to` `yyyy-mm-dd` 形式的日期, `limit` 是一個整數,表示要送回多少份日誌。
```js
async (getUserInput) => {

View File

@@ -14,21 +14,21 @@ dashedName: file-metadata-microservice
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-project-filemetadata" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 上的初始化項目</a>來完成你的項目。
- 使用你選擇的網站生成器來完成項目。 需要包含我們 GitHub 倉庫的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit按照以下步驟設置項目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
當你完成後,請將一個確保正常運行的 demo項目演示託管在可以公開訪問的平臺上。 然後將 demo 的 URL 提交到 `Solution Link` 中。 此外,還可以將項目的源碼鏈接提交到 `GitHub Link` 中。
# --instructions--
**HINT:** You can use the `multer` npm package to handle file uploading.
** 提示:**可以使用 `multer` npm 包來處理上傳文件。
# --hints--
You should provide your own project, not the example URL.
你應該提交自己的項目,而不是示例的 URL
```js
(getUserInput) => {
@@ -40,7 +40,7 @@ You should provide your own project, not the example URL.
};
```
You can submit a form that includes a file upload.
你可以提交一個包含上傳文件的表單。
```js
async (getUserInput) => {
@@ -51,7 +51,7 @@ async (getUserInput) => {
};
```
The form file input field has the `name` attribute set to `upfile`.
表單文件輸入字段的 `name` 屬性設置成 `upfile`
```js
async (getUserInput) => {
@@ -62,7 +62,7 @@ async (getUserInput) => {
};
```
When you submit a file, you receive the file `name`, `type`, and `size` in bytes within the JSON response.
當你提交一個文件時,在 JSON 響應中收到文件的 `name``type` `size`,以 bytes(字節)爲單位。
```js
async (getUserInput) => {

View File

@@ -14,17 +14,17 @@ dashedName: request-header-parser-microservice
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-project-headerparser" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 上的初始化項目</a>來完成你的項目。
- 使用你選擇的網站生成器來完成項目。 需要包含我們 GitHub 倉庫的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit請按照以下步驟設置項目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
當你完成後,請將一個確保正常運行的 demo項目演示託管在可以公開訪問的平臺上。 然後將 demo 的 URL 提交到 `Solution Link` 中。 此外,將項目的源碼鏈接提交到 `GitHub Link` 字段中。
# --hints--
You should provide your own project, not the example URL.
你應該提交自己的項目,而不是示例的 URL
```js
(getUserInput) => {
@@ -36,7 +36,7 @@ You should provide your own project, not the example URL.
};
```
A request to `/api/whoami` should return a JSON object with your IP address in the `ipaddress` key.
`/api/whoami` 發送請求,返回一個 JSON 對象這個JSON 對象應該含有存放 IP 地址的 `ipaddress` 鍵。
```js
(getUserInput) =>
@@ -48,7 +48,7 @@ A request to `/api/whoami` should return a JSON object with your IP address in t
);
```
A request to `/api/whoami` should return a JSON object with your preferred language in the `language` key.
`/api/whoami` 發送請求,返回一個 JSON 對象,這個 JSON 對象應該含有存放語言首選項的 `language` 鍵。
```js
(getUserInput) =>
@@ -60,7 +60,7 @@ A request to `/api/whoami` should return a JSON object with your preferred langu
);
```
A request to `/api/whoami` should return a JSON object with your software in the `software` key.
`/api/whoami` 發送請求,返回一個 JSON 對象,這個 JSON 對象應該含有存放(發送請求的)軟件的 `software` 鍵。
```js
(getUserInput) =>

View File

@@ -14,19 +14,19 @@ dashedName: timestamp-microservice
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-project-timestamp" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 上的初始化項目</a>來完成你的項目。
- 使用你選擇的網站生成器來完成項目。 需要包含我們 GitHub 倉庫的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit請按照以下步驟設置項目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
當你完成後,請將一個確保正常運行的 demo項目演示託管在可以公開訪問的平臺上。 然後將 demo 的 URL 提交到 `Solution Link` 字段中。 此外,將項目的源碼鏈接提交到 `GitHub Link` 字段中。
**Note:** Time zones conversion is not a purpose of this project, so assume all sent valid dates will be parsed with `new Date()` as GMT dates.
**注意:**時區轉換不是本項目的目的,因此假設所有發送的有效日期將使用 `new Date()` 解析爲 GMT 日期。
# --hints--
You should provide your own project, not the example URL.
你應該提交自己的項目,而不是示例的 URL
```js
(getUserInput) => {
@@ -36,7 +36,7 @@ You should provide your own project, not the example URL.
};
```
A request to `/api/:date?` with a valid date should return a JSON object with a `unix` key that is a Unix timestamp of the input date in milliseconds (as type Number)
一個對 `/api/:date?` 的有效日期的請求應該返回一個 JSON 對象,該對象的 `unix` 鍵是輸入日期的 Unix 時間戳,單位是毫秒(數字類型)。
```js
(getUserInput) =>
@@ -54,7 +54,7 @@ A request to `/api/:date?` with a valid date should return a JSON object with a
);
```
A request to `/api/:date?` with a valid date should return a JSON object with a `utc` key that is a string of the input date in the format: `Thu, 01 Jan 1970 00:00:00 GMT`
對具有有效日期的 `/api/:date?` 的請求應返回一個帶有 `utc` 鍵的 JSON 對象,該鍵是輸入日期的字符串,格式爲:`Thu, 01 Jan 1970 00:00:00 GMT`
```js
(getUserInput) =>
@@ -72,7 +72,7 @@ A request to `/api/:date?` with a valid date should return a JSON object with a
);
```
A request to `/api/1451001600000` should return `{ unix: 1451001600000, utc: "Fri, 25 Dec 2015 00:00:00 GMT" }`
`/api/1451001600000` 的請求應該返回 `{ unix: 1451001600000, utc: "Fri, 25 Dec 2015 00:00:00 GMT" }`
```js
(getUserInput) =>
@@ -89,7 +89,7 @@ A request to `/api/1451001600000` should return `{ unix: 1451001600000, utc: "Fr
);
```
Your project can handle dates that can be successfully parsed by `new Date(date_string)`
你的項目可以處理可以通過 `new Date(date_string)` 成功解析的日期。
```js
(getUserInput) =>
@@ -106,7 +106,7 @@ Your project can handle dates that can be successfully parsed by `new Date(date_
);
```
If the input date string is invalid, the api returns an object having the structure `{ error : "Invalid Date" }`
如果輸入的日期字符串無效api 將返回一個具有結構 `{ error : "Invalid Date" }` 的對象。
```js
(getUserInput) =>
@@ -120,7 +120,7 @@ If the input date string is invalid, the api returns an object having the struct
);
```
An empty date parameter should return the current time in a JSON object with a `unix` key
一個空的日期參數應該返回一個帶有 `unix` 鍵的 JSON 對象中的當前時間。
```js
(getUserInput) =>
@@ -135,7 +135,7 @@ An empty date parameter should return the current time in a JSON object with a `
);
```
An empty date parameter should return the current time in a JSON object with a `utc` key
一個空日期參數應返回帶有 `utc` 鍵的 JSON 對象中的當前時間。
```js
(getUserInput) =>

View File

@@ -14,21 +14,21 @@ dashedName: url-shortener-microservice
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-project-urlshortener" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 上的初始化項目</a>來完成你的項目。
- 使用你選擇的網站生成器來完成項目。 需要包含我們 GitHub 倉庫的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit請按照以下步驟設置項目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
當你完成後,請將一個確保正常運行的 demo項目演示託管在可以公開訪問的平臺上。 然後將 demo 的 URL 提交到 `Solution Link` 字段中。 此外,將項目的源碼鏈接提交到 `GitHub Link` 字段中。
# --instructions--
**HINT:** Do not forget to use a body parsing middleware to handle the POST requests. Also, you can use the function `dns.lookup(host, cb)` from the `dns` core module to verify a submitted URL.
**提示:**不要忘記使用 body parsing 中間件來處理 POST 請求。 也可以使用 `dns` 核心模塊中的 `dns.lookup(host, cb)` 函數驗證提交的 URL
# --hints--
You should provide your own project, not the example URL.
你應該提交自己的項目,而不是示例的 URL
```js
(getUserInput) => {
@@ -40,7 +40,7 @@ You should provide your own project, not the example URL.
};
```
You can POST a URL to `/api/shorturl` and get a JSON response with `original_url` and `short_url` properties. Here's an example: `{ original_url : 'https://freeCodeCamp.org', short_url : 1}`
可以通過 POST 請求給 `/api/shorturl` 發送一個 URL並返回一個帶有 `original_url` `short_url` 屬性的 JSON 響應。 例如:`{ original_url : 'https://freeCodeCamp.org', short_url : 1}`
```js
async (getUserInput) => {
@@ -62,7 +62,7 @@ async (getUserInput) => {
};
```
When you visit `/api/shorturl/<short_url>`, you will be redirected to the original URL.
當你訪問 `/api/shorturl/<short_url>` 時,將重定向到原來的 URL
```js
async (getUserInput) => {
@@ -94,7 +94,7 @@ async (getUserInput) => {
};
```
If you pass an invalid URL that doesn't follow the valid `http://www.example.com` format, the JSON response will contain `{ error: 'invalid url' }`
如果你傳入了一個無效的 URL 且沒有遵循有效的 `http://www.example.com` 格式JSON 響應將包含 `{ error: 'invalid url' }`
```js
async (getUserInput) => {

View File

@@ -14,27 +14,27 @@ dashedName: meet-the-node-console
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-express" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 上的初始化項目</a>來完成這些挑戰。
- 使用你選擇的網站生成器來完成項目。 需要包含我們 GitHub 倉庫的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit請按照以下步驟設置項目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field.
當你完成後,請將一個確保正常運行的 demo項目演示託管在可以公開訪問的平臺上。 然後將 demo 的 URL 提交到 `Solution Link` 字段中。
During the development process, it is important to be able to check whats going on in your code.
在開發過程中,能夠隨時看到代碼的運行結果是非常重要的。
Node is just a JavaScript environment. Like client side JavaScript, you can use the console to display useful debug information. On your local machine, you would see console output in a terminal. On Replit, a terminal is open in the right pane by default.
Node 只是一個 JavaScript 環境。 與客戶端 JavaScript 一樣,你可以使用控制檯顯示有用的調試信息。 在你的本地計算機上,你可以在終端中看到控制檯輸出。 在 Replit 上,右側邊欄會默認打開一個終端。
We recommend to keep the terminal open while working at these challenges. By reading the output in the terminal, you can see any errors that may occur.
我們建議在做這些挑戰題時保持終端打開的狀態。 通過閱讀終端的輸出,你可以看到可能發生的任何錯誤。
# --instructions--
Modify the `myApp.js` file to log "Hello World" to the console.
修改 `myApp.js` 文件,在控制檯打印出 “Hello World”。
# --hints--
`"Hello World"` should be in the console
控制檯應該輸出 `"Hello World"`
```js
(getUserInput) =>

View File

@@ -14,19 +14,19 @@ dashedName: how-to-use-package-json-the-core-of-any-node-js-project-or-npm-packa
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-npm" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 上的初始化項目</a>來完成這些挑戰。
- 使用你選擇的網站生成器來完成項目。 需要包含我們 GitHub 倉庫的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit請按照以下步驟設置項目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field.
當你完成後,請將一個確保正常運行的 demo項目演示託管在可以公開訪問的平臺上。 然後將 demo 的 URL 提交到 `Solution Link` 字段中。
The `package.json` file is the center of any Node.js project or npm package. It stores information about your project, similar to how the &lt;head> section of an HTML document describes the content of a webpage. It consists of a single JSON object where information is stored in key-value pairs. There are only two required fields; "name" and "version", but its good practice to provide additional information about your project that could be useful to future users or maintainers.
`package.json` 文件是所有 Node.js 項目和 npm 包的樞紐, 和 HTML 文檔中的 &lt;head> 部分用來描述網頁的配置信息(元數據)一樣,它存儲你的項目的相關信息。 它由單個 JSON 對象組成,並以鍵值對的形式存儲項目信息, 且至少包含兩個必填字段“name” 和 “version”——但是最好提供有關項目的其他信息這將對用戶或者維護者有所幫助。
If you look at the file tree of your project, you will find the package.json file on the top level of the tree. This is the file that you will be improving in the next couple of challenges.
如果你能找到項目的文件樹,那麼可以在文件樹的最外層找到 package.json 在接下來的幾個挑戰中你將完善這個文件。
One of the most common pieces of information in this file is the `author` field. It specifies who created the project, and can consist of a string or an object with contact or other details. An object is recommended for bigger projects, but a simple string like the following example will do for this project.
在這個文件中最常見的信息之一是 `author` 字段, 它說明了項目的創建者,可以包含一個帶有聯繫人信息或其他信息的字符串或對象。 對於較大的項目,建議使用對象;但是在我們的項目中,一個簡單的字符串就夠了,比如下面的例子:
```json
"author": "Jane Doe",
@@ -34,13 +34,13 @@ One of the most common pieces of information in this file is the `author` field.
# --instructions--
Add your name as the `author` of the project in the package.json file.
在 package.json 文件中加入你的名字作爲項目的 `author`
**Note:** Remember that youre writing JSON, so all field names must use double-quotes (") and be separated with a comma (,).
**注意:**你正在寫 JSON所有的字段名必須用雙引號")包裹,也必須用逗號(,)分割。
# --hints--
package.json should have a valid "author" key
package.json 應該有一個有效的 “author” 鍵。
```js
(getUserInput) =>

View File

@@ -14,25 +14,25 @@ dashedName: install-and-set-up-mongoose
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-mongomongoose" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 上的初始化項目</a>來完成這些挑戰。
- 使用你選擇的網站生成器來完成項目。 需要包含我們 GitHub 倉庫的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit請按照以下步驟設置項目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field.
當你完成後,請將一個確保正常運行的 demo項目演示託管在可以公開訪問的平臺上。 然後將 demo 的 URL 提交到 `Solution Link` 字段中。
In this challenge, you will set up a MongoDB Atlas database and import the required packages to connect to it.
在這個挑戰中,你將建立一個 MongoDB Atlas 數據庫並導入連接到它所需的軟件包。
Follow <a href='https://www.freecodecamp.org/news/get-started-with-mongodb-atlas/' target="_blank" rel="noopener noreferrer nofollow">this tutorial</a> to set up a hosted database on MongoDB Atlas.
按照<a href='https://https://www.freecodecamp.org/chinese/news/get-started-with-mongodb-atlas/' target="_blank" rel="noopener noreferrer nofollow">這篇教程</a>在 MongoDB Atlas 創建一個託管數據庫。
# --instructions--
`mongoose@^5.11.15` has been added to your projects `package.json` file. First, require mongoose as `mongoose` in `myApp.js`. Next, create a `.env` file and add a `MONGO_URI` variable to it. Its value should be your MongoDB Atlas database URI. Be sure to surround the URI with single or double quotes, and remember that you can't use spaces around the `=` in environment variables. For example, `MONGO_URI='VALUE'`.
`mongoose@^5.11.15` 已添加到你項目的 `package.json` 文件中。 首先,在 `myApp.js` 中請求 mongoose `mongoose`。 接下來,創建一個 `.env` 文件並向其中添加一個 `MONGO_URI` 變量。 變量的值爲你的 MongoDB Atlas 數據庫 URI。 應用單引號或雙引號包裹 URI。請記住環境變量 `=` 兩邊不能有空格。 例如,`MONGO_URI='VALUE'`
**Note:** If you are using Replit, you cannot create a `.env` file. Instead, use the built-in <dfn>SECRETS</dfn> tab to add the variable. <em>Do not</em> surround the values with quotes when using the <em>SECRETS</em> tab.
**注意:**如果你使用的是 Replit則無法創建 `.env` 文件。 相反,使用內置的 <dfn>SECRETS</dfn> 選項卡來添加變量。 在使用 <em>SECRETS</em> 選項卡時,<em>不要</em>將值括在引號中。
When you are done, connect to the database using the following syntax:
完成後,使用以下語法連接到數據庫:
```js
mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true });
@@ -40,7 +40,7 @@ mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true }
# --hints--
"mongoose version ^5.11.15" dependency should be in package.json
mongoose version ^5.11.15” 依賴項應該在 package.json 中。
```js
(getUserInput) =>
@@ -60,7 +60,7 @@ mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true }
);
```
"mongoose" should be connected to a database
應使用 “mongoose” 連接數據庫。
```js
(getUserInput) =>

View File

@@ -10,9 +10,9 @@ dashedName: arithmetic-formatter
你將使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-arithmetic-formatter" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 的初始化項目</a>來完成這個項目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
# --instructions--
@@ -63,16 +63,16 @@ arithmetic_arranger(["32 + 8", "1 - 3801", "9999 + 9999", "523 - 49"], True)
如果提供的問題格式正確,該函數將返回正確的轉換,否則,它將 **返回** 一個 **字符串** 來描述對用戶有意義的錯誤。
- Situations that will return an error:
- If there are **too many problems** supplied to the function. The limit is **five**, anything more will return: `Error: Too many problems.`
- The appropriate operators the function will accept are **addition** and **subtraction**. Multiplication and division will return an error. Other operators not mentioned in this bullet point will not need to be tested. The error returned will be: `Error: Operator must be '+' or '-'.`
- Each number (operand) should only contain digits. Otherwise, the function will return: `Error: Numbers must only contain digits.`
- Each operand (aka number on each side of the operator) has a max of four digits in width. Otherwise, the error string returned will be: `Error: Numbers cannot be more than four digits.`
- If the user supplied the correct format of problems, the conversion you return will follow these rules:
- There should be a single space between the operator and the longest of the two operands, the operator will be on the same line as the second operand, both operands will be in the same order as provided (the first will be the top one and the second will be the bottom).
- Numbers should be right-aligned.
- There should be four spaces between each problem.
- There should be dashes at the bottom of each problem. The dashes should run along the entire length of each problem individually. (The example above shows what this should look like.)
- 會返回錯誤的情況:
- 如果提供給函數的**問題過多**。 限制爲**五個**,更多的將返回:`Error: Too many problems.`
- 函數可以接受的運算符是**加法**和**減法**。 乘法和除法將返回錯誤。 本要點中未提及的其他運算符將不需要進行測試。 返回的錯誤將是:`Error: Operator must be '+' or '-'.`
- 每個數字(操作數)應該只包含數字。 否則,該函數將返回:`Error: Numbers must only contain digits.`
- 每個操作數(即運算符每一側的數字)的寬度最多爲四位數字。 否則,返回的錯誤字符串將爲:`Error: Numbers cannot be more than four digits.`
- 如果用戶提供了正確格式的問題,返回的轉換將遵循以下規則:
- 操作符和兩個操作數中最長的一個之間應該有一個空格,操作符將與第二個操作數在同一行,兩個操作數的順序與提供的相同(第一個是上面的,第二個是下面的)。
- 數字應該右對齊。
- 每個問題之間應該有四個空格。
- 每個問題的底部都應該有破折號。 破折號應該單獨沿着每個問題的整個長度延伸。 (上面的例子展示了這應該是什麼樣子。)
## 開發

View File

@@ -10,26 +10,26 @@ dashedName: budget-app
你將使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-budget-app" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 的初始化項目</a>來完成這個項目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
# --instructions--
完成 `budget.py` 中的 `Category` 類。 它應該能夠根據不同的預算類別實例化對象,例如 *食物**服裝**娛樂* 。 創建對象時,它們以類別的名稱傳遞。 該類應該有一個名爲 `ledger` 的實例變量,它是一個列表。 該類還應包含以下方法:
- A `deposit` method that accepts an amount and description. If no description is given, it should default to an empty string. The method should append an object to the ledger list in the form of `{"amount": amount, "description": description}`.
- A `withdraw` method that is similar to the `deposit` method, but the amount passed in should be stored in the ledger as a negative number. If there are not enough funds, nothing should be added to the ledger. This method should return `True` if the withdrawal took place, and `False` otherwise.
- A `get_balance` method that returns the current balance of the budget category based on the deposits and withdrawals that have occurred.
- A `transfer` method that accepts an amount and another budget category as arguments. The method should add a withdrawal with the amount and the description "Transfer to [Destination Budget Category]". The method should then add a deposit to the other budget category with the amount and the description "Transfer from [Source Budget Category]". If there are not enough funds, nothing should be added to either ledgers. This method should return `True` if the transfer took place, and `False` otherwise.
- A `check_funds` method that accepts an amount as an argument. It returns `False` if the amount is greater than the balance of the budget category and returns `True` otherwise. This method should be used by both the `withdraw` method and `transfer` method.
- 接受金額和描述的 `deposit` 方法。 如果沒有給出描述,它應該默認爲一個空字符串。 該方法應以 `{"amount": amount, "description": description}` 的形式將對象附加到賬本列表。
- `withdraw` 方法類似於 `deposit` 方法,但傳入的金額應作爲負數存儲在賬本中。 如果沒有足夠的資金,則不應向賬本添加任何內容。 如果取款發生,此方法應返回 `True`,否則返回 `False`
- `get_balance` 方法,根據發生的存款和取款返回預算類別的當前餘額。
- `transfer` 方法,它接受一個金額和另一個預算類別作爲參數。 該方法應添加帶有金額和描述 “Transfer to [目的地預算類別]”的提款。 然後,該方法應將存款添加到其他預算類別,其金額和描述爲 “Transfer from [來源預算類別]”。 如果沒有足夠的資金,則不應向任一賬本添加任何內容。 如果轉賬發生,此方法應返回 `True`,否則返回 `False`
- 接受金額作爲參數的 `check_funds` 方法。 如果金額大於預算類別的餘額,則返回 `False`,否則返回 `True` `withdraw` 方法和 `transfer` 方法都應該使用此方法。
打印預算對象時,它應顯示:
- A title line of 30 characters where the name of the category is centered in a line of `*` characters.
- A list of the items in the ledger. Each line should show the description and amount. The first 23 characters of the description should be displayed, then the amount. The amount should be right aligned, contain two decimal places, and display a maximum of 7 characters.
- A line displaying the category total.
- 30 個字符的標題行,類別名稱居中在一行 `*` 字符中。
- 賬本中的項目列表。 每行應顯示描述和金額。 應顯示描述的前 23 個字符,然後是金額。 金額應右對齊,包含兩位小數,最多顯示 7 個字符。
- 一行顯示類別總數。
下面是一個輸出示例:

View File

@@ -10,9 +10,9 @@ dashedName: polygon-area-calculator
你將使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-polygon-area-calculator" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 的初始化項目</a>來完成這個項目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
# --instructions--
@@ -25,11 +25,11 @@ dashedName: polygon-area-calculator
- `set_width`
- `set_height`
- `get_area`: Returns area (`width * height`)
- `get_perimeter`: Returns perimeter (`2 * width + 2 * height`)
- `get_diagonal`: Returns diagonal (`(width ** 2 + height ** 2) ** .5`)
- `get_picture`: Returns a string that represents the shape using lines of "\*". The number of lines should be equal to the height and the number of "\*" in each line should be equal to the width. There should be a new line (`\n`) at the end of each line. If the width or height is larger than 50, this should return the string: "Too big for picture.".
- `get_amount_inside`: Takes another shape (square or rectangle) as an argument. Returns the number of times the passed in shape could fit inside the shape (with no rotations). For instance, a rectangle with a width of 4 and a height of 8 could fit in two squares with sides of 4.
- `get_area`:返回面積(`width * height`
- `get_perimeter`:返回周長(`2 * width + 2 * height`
- `get_diagonal`:返回對角線(`(width ** 2 + height ** 2) ** .5`
- `get_picture`:返回一個字符串,該字符串使用包含 “\*” 的行來表示形狀。 行數應等於高度,每行中 “\*” 的數量應等於寬度。 每行末尾應該有一個新行(`\n`)。 如果寬度或高度大於 50則應返回字符串Too big for picture.”。
- `get_amount_inside`:以另一個形狀(正方形或矩形)作爲參數。 返回傳入的形狀可以裝進該形狀的次數(沒有旋轉)。 例如,一個寬爲 4、高爲 8 的矩形可以放入兩個邊長爲 4 的正方形。
另外,如果一個 Rectangle 實例被表示爲一個字符串,它應該看起來像: `Rectangle(width=5, height=10)`

View File

@@ -10,9 +10,9 @@ dashedName: probability-calculator
你將使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-probability-calculator" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 的初始化項目</a>來完成這個項目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
# --instructions--
@@ -35,10 +35,10 @@ hat3 = Hat(red=5, orange=4, black=1, blue=0, pink=2, striped=9)
接下來,在 `prob_calculator.py`(不是在 `Hat` 類中)創建一個 `experiment` 函數。 此函數應接受以下參數:
- `hat`: A hat object containing balls that should be copied inside the function.
- `expected_balls`: An object indicating the exact group of balls to attempt to draw from the hat for the experiment. For example, to determine the probability of drawing 2 blue balls and 1 red ball from the hat, set `expected_balls` to `{"blue":2, "red":1}`.
- `num_balls_drawn`: The number of balls to draw out of the hat in each experiment.
- `num_experiments`: The number of experiments to perform. (The more experiments performed, the more accurate the approximate probability will be.)
- `hat`:一個包含球的帽子對象,應該在函數內複製。
- `expected_balls`:一個對象,指示嘗試從帽子中抽取的確切球組以進行實驗。 例如,要確定從帽子中抽取 2 個藍球和 1 個紅球的概率,將 `expected_balls` 設置爲 `{"blue":2, "red":1}`
- `num_balls_drawn`:每次實驗中從帽子中抽出的球數。
- `num_experiments`:要執行的實驗數量。 (進行的實驗越多,近似概率就越準確。)
`experiment` 函數應該返回一個概率。

View File

@@ -10,17 +10,17 @@ dashedName: time-calculator
你將使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-time-calculator" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 的初始化項目</a>來完成這個項目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
# --instructions--
編寫一個名爲 `add_time` 的函數,它接受兩個必需參數和一個可選參數:
- a start time in the 12-hour clock format (ending in AM or PM)
- a duration time that indicates the number of hours and minutes
- (optional) a starting day of the week, case insensitive
- 12 小時制的開始時間(以 AM PM 結束)
- 指示小時數和分鐘數的持續時間
- (可選)一週的開始日期,不區分大小寫
該函數應將持續時間添加到開始時間並返回結果。

View File

@@ -10,16 +10,16 @@ dashedName: demographic-data-analyzer
你將使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-demographic-data-analyzer" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 的初始化項目</a>來完成這個項目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
我們仍在開發 Python 課程的交互式教學部分。 目前,你可以在 YouTube 上通過 freeCodeCamp.org 上傳的一些視頻學習這個項目相關的知識。
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a> (14 hours)
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">給所有人的 Python 課程</a>14 小時)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">How to Analyze Data with Python Pandas</a> (10 hours)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">如何使用 Python Pandas 分析數據</a>10 小時)
# --instructions--
@@ -37,15 +37,15 @@ dashedName: demographic-data-analyzer
你必須使用 Pandas 來回答以下問題:
- How many people of each race are represented in this dataset? This should be a Pandas series with race names as the index labels. (`race` column)
- What is the average age of men?
- What is the percentage of people who have a Bachelor's degree?
- What percentage of people with advanced education (`Bachelors`, `Masters`, or `Doctorate`) make more than 50K?
- What percentage of people without advanced education make more than 50K?
- What is the minimum number of hours a person works per week?
- What percentage of the people who work the minimum number of hours per week have a salary of more than 50K?
- What country has the highest percentage of people that earn >50K and what is that percentage?
- Identify the most popular occupation for those who earn >50K in India.
- 這個數據集中每個種族有多少人? 這應該是一個以種族名稱作爲索引標籤的 Pandas 系列。 `race` 欄)
- 男性的平均年齡是多少?
- 擁有學士學位的人的百分比是多少?
- 受過高等教育(`Bachelors``Masters` `Doctorate`)且收入超過 50K 的人佔多大比例?
- 沒有受過高等教育且收入超過 50K 的人的比例是多少?
- 一個人每週最少工作多少小時?
- 每週工作最少小時數的人中有多少人的工資超過 50K
- 哪個國家/地區的收入 >50K 的人口比例最高,該比例是多少?
- 找出印度收入 >50K 的人最受歡迎的職業。
使用文件 `demographic_data_analyzer` 中的啓動代碼。 更新代碼以便將所有設置爲“None”的變量設置爲適當的計算或代碼。 將所有小數四捨五入到最接近的十分之一。

View File

@@ -10,16 +10,16 @@ dashedName: mean-variance-standard-deviation-calculator
你將使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-mean-variance-standard-deviation-calculator" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 的初始化項目</a>來完成這個項目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
我們仍在開發 Python 課程的交互式教學部分。 目前,你可以在 YouTube 上通過 freeCodeCamp.org 上傳的一些視頻學習這個項目相關的知識。
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a>(14 hours)
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">給所有人的 Python 課程</a>14 小時)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">How to Analyze Data with Python Pandas</a> (10 hours)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">如何使用 Python Pandas 分析數據</a>10 小時)
# --instructions--

View File

@@ -10,16 +10,16 @@ dashedName: medical-data-visualizer
你將使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-medical-data-visualizer" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 的初始化項目</a>來完成這個項目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
我們仍在開發 Python 課程的交互式教學部分。 目前,你可以在 YouTube 上通過 freeCodeCamp.org 上傳的一些視頻學習這個項目相關的知識。
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a>(14 hours)
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">給所有人的 Python 課程</a>14 小時)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">How to Analyze Data with Python Pandas</a> (10 hours)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">如何使用 Python Pandas 分析數據</a>10 小時)
# --instructions--
@@ -52,16 +52,16 @@ dashedName: medical-data-visualizer
`medical_data_visualizer.py` 中使用數據完成以下任務:
- Add an `overweight` column to the data. To determine if a person is overweight, first calculate their BMI by dividing their weight in kilograms by the square of their height in meters. If that value is > 25 then the person is overweight. Use the value 0 for NOT overweight and the value 1 for overweight.
- Normalize the data by making 0 always good and 1 always bad. If the value of `cholesterol` or `gluc` is 1, make the value 0. If the value is more than 1, make the value 1.
- Convert the data into long format and create a chart that shows the value counts of the categorical features using seaborn's `catplot()`. The dataset should be split by 'Cardio' so there is one chart for each `cardio` value. The chart should look like `examples/Figure_1.png`.
- Clean the data. Filter out the following patient segments that represent incorrect data:
- diastolic pressure is higher than systolic (Keep the correct data with `(df['ap_lo'] <= df['ap_hi'])`)
- height is less than the 2.5th percentile (Keep the correct data with `(df['height'] >= df['height'].quantile(0.025))`)
- height is more than the 97.5th percentile
- weight is less than the 2.5th percentile
- weight is more than the 97.5th percentile
- Create a correlation matrix using the dataset. Plot the correlation matrix using seaborn's `heatmap()`. Mask the upper triangle. The chart should look like `examples/Figure_2.png`.
- 給數據添加一列 `overweight`。 要確定一個人是否超重,首先通過將他們的體重(公斤)除以他們的身高(米)的平方來計算他們的 BMI。 如果該值是 > 25則此人超重。 使用值 0 表示不超重,使用值 1 表示超重。
- 使用 0 表示好的和 1 表示壞,來規範化數據。 如果 `cholesterol` `gluc` 的值爲 1則將值設爲 0。 如果值大於 1則將值設爲 1
- 將數據轉換爲長格式並使用 seaborn `catplot()` 創建一個顯示分類特徵值計數的圖表。 數據集應按 “Cardio” 拆分,因此每個 `cardio` 值都有一個圖表。 該圖表應該看起來像 `examples/Figure_1.png`
- 清理數據。 過濾掉以下代表不正確數據的患者段:
- 舒張壓高於收縮壓(使用 `(df['ap_lo'] <= df['ap_hi'])` 保留正確的數據)
- 高度小於第 2.5 個百分位數(使用 `(df['height'] >= df['height'].quantile(0.025))` 保留正確的數據)
- 身高超過第 97.5 個百分位
- 體重小於第 2.5 個百分位
- 體重超過第 97.5 個百分位
- 使用數據集創建相關矩陣。 使用 seaborn 的 `heatmap()` 繪製相關矩陣。 遮罩上三角。 該圖表應類似於 `examples/Figure_2.png`
每當變量設置爲 `None` 時,請確保將其設置爲正確的代碼。

View File

@@ -10,16 +10,16 @@ dashedName: page-view-time-series-visualizer
你將使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-page-view-time-series-visualizer" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 的初始化項目</a>來完成這個項目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
我們仍在開發 Python 課程的交互式教學部分。 目前,你可以在 freeCodeCamp.org 的 YouTube 頻道中通過視頻學習到這個項目相關的所有知識
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a>(14 hours)
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">給所有人的 Python 課程</a>14 小時)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">How to Analyze Data with Python Pandas</a> (10 hours)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">如何使用 Python Pandas 分析數據</a>10 小時)
# --instructions--
@@ -27,11 +27,11 @@ dashedName: page-view-time-series-visualizer
使用數據完成以下任務:
- Use Pandas to import the data from "fcc-forum-pageviews.csv". Set the index to the `date` column.
- Clean the data by filtering out days when the page views were in the top 2.5% of the dataset or bottom 2.5% of the dataset.
- Create a `draw_line_plot` function that uses Matplotlib to draw a line chart similar to "examples/Figure_1.png". The title should be `Daily freeCodeCamp Forum Page Views 5/2016-12/2019`. The label on the x axis should be `Date` and the label on the y axis should be `Page Views`.
- Create a `draw_bar_plot` function that draws a bar chart similar to "examples/Figure_2.png". It should show average daily page views for each month grouped by year. The legend should show month labels and have a title of `Months`. On the chart, the label on the x axis should be `Years` and the label on the y axis should be `Average Page Views`.
- Create a `draw_box_plot` function that uses Seaborn to draw two adjacent box plots similar to "examples/Figure_3.png". These box plots should show how the values are distributed within a given year or month and how it compares over time. The title of the first chart should be `Year-wise Box Plot (Trend)` and the title of the second chart should be `Month-wise Box Plot (Seasonality)`. Make sure the month labels on bottom start at `Jan` and the x and y axis are labeled correctly. The boilerplate includes commands to prepare the data.
- 使用 Pandas 從 “fcc-forum-pageviews.csv” 導入數據。 將索引設置爲 `date` 列。
- 通過過濾掉頁面瀏覽量位於數據集前 2.5% 或數據集後 2.5% 的日期來清理數據。
- 創建一個 `draw_line_plot` 函數,該函數使用 Matplotlib 繪製類似於 “examples/Figure_1.png” 的折線圖。 標題應爲 `Daily freeCodeCamp Forum Page Views 5/2016-12/2019`。 x 軸上的標籤應爲 `Date`y 軸上的標籤應爲 `Page Views`
- 創建一個 `draw_bar_plot` 函數,用於繪製類似於 “examples/Figure_2.png” 的條形圖。 它應該顯示按年份分組的每個月的平均每日頁面瀏覽量。 圖例應顯示月份標籤並具有 `Months` 標題。 在圖表上x 軸上的標籤應爲 `Years`y 軸上的標籤應爲 `Average Page Views`
- 創建一個 `draw_box_plot` 函數,該函數使用 Seaborn 繪製兩個相鄰的箱形圖,類似於 “examples/Figure_3.png”。 這些箱線圖應顯示值在給定年份或月份內的分佈情況以及隨時間推移的比較情況。 第一個圖表的標題應爲 `Year-wise Box Plot (Trend)`,第二個圖表的標題應爲 `Month-wise Box Plot (Seasonality)`。 確保底部的月份標籤從 `Jan` 開始,並且 x 和 y 軸標記正確。 樣板文件包括準備數據的命令。
對於每個圖表,請確保使用數據框的副本。 單元測試是在 `test_module.py` 下爲你編寫的。

View File

@@ -10,16 +10,16 @@ dashedName: sea-level-predictor
你將使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-sea-level-predictor" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 的初始化項目</a>來完成這個項目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
我們仍在開發 Python 課程的交互式教學部分。 目前,你可以在 YouTube 上通過 freeCodeCamp.org 上傳的一些視頻學習這個項目相關的知識。
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a>(14 hours)
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">給所有人的 Python 課程</a>14 小時)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">How to Analyze Data with Python Pandas</a> (10 hours)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">如何使用 Python Pandas 分析數據</a>10 小時)
# --instructions--
@@ -27,11 +27,11 @@ dashedName: sea-level-predictor
使用數據完成以下任務:
- Use Pandas to import the data from `epa-sea-level.csv`.
- Use matplotlib to create a scatter plot using the `Year` column as the x-axis and the `CSIRO Adjusted Sea Level` column as the y-axix.
- Use the `linregress` function from `scipy.stats` to get the slope and y-intercept of the line of best fit. Plot the line of best fit over the top of the scatter plot. Make the line go through the year 2050 to predict the sea level rise in 2050.
- Plot a new line of best fit just using the data from year 2000 through the most recent year in the dataset. Make the line also go through the year 2050 to predict the sea level rise in 2050 if the rate of rise continues as it has since the year 2000.
- The x label should be `Year`, the y label should be `Sea Level (inches)`, and the title should be `Rise in Sea Level`.
- 使用 Pandas `epa-sea-level.csv` 導入數據。
- 使用 matplotlib 創建散點圖,將 `Year` 列作爲 x 軸,將 `CSIRO Adjusted Sea Level` 列作爲 y 軸。
- 使用 `scipy.stats` 中的 `linregress` 函數來獲得最佳擬合線的斜率和 y 截距。 在散點圖的頂部繪製最佳擬合線。 使線穿過 2050 年以預測 2050 年的海平面上升。
- 僅使用數據集中從 2000 年到最近一年的數據繪製一條新的最佳擬合線。 如果上升速度繼續與 2000 年一樣,則使該線也經過 2050 年以預測 2050 年的海平面上升。
- x 標籤應爲 `Year`y 標籤應爲 `Sea Level (inches)`,標題應爲 `Rise in Sea Level`
單元測試是在 `test_module.py` 下爲你編寫的。

View File

@@ -12,9 +12,9 @@ dashedName: rock-paper-scissors
你將使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-rock-paper-scissors" target="_blank" rel="noopener noreferrer nofollow">我們在 Replit 的初始化項目</a>來完成這個項目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中導入項目。
- 接着,你將看到一個 `.replit` 窗口。
- 選擇 `Use run command` 並點擊 `Done` 按鈕。
我們仍在開發機器學習課程的交互式課程部分。 現在,你需要使用其他資源來學習如何通過這一挑戰。
@@ -36,9 +36,9 @@ dashedName: rock-paper-scissors
要測試你的代碼,請使用 `play` 函數玩遊戲。 `play` 函數有四個參數:
- two players to play against each other (the players are actually functions)
- the number of games to play in the match
- an optional argument to see a log of each game. Set it to `True` to see these messages.
- 兩個玩家互相對戰(玩家實際上是函數)
- 對戰中的比賽場數
- 一個可選參數來查看每場比賽的日誌。 將其設置爲 `True` 以查看這些消息。
```py
play(player1, player2, num_games[, verbose])

View File

@@ -7,7 +7,7 @@ dashedName: step-75
# --description--
In some browsers, the _heart_ emoji may look slightly different from the previous step. 這是因爲字符的某些屬性被 `font-weight``bold` 樣式覆蓋。
在某些瀏覽器中, _愛心_ emoji 表情可能與上一步略有不同。 這是因爲字符的某些屬性被 `font-weight``bold` 樣式覆蓋。
要修復這個問題,需要定位心形表情符號的 `div` 並將其 `font-weight` 設置爲其原始值。

View File

@@ -9,7 +9,7 @@ dashedName: step-7
在開始爲你添加的 `div` 設置樣式之前,你需要將 CSS 鏈接到 HTML。
添加 `link` 元素以鏈接你的 `styles.css` 文件。 Set the `href` to `styles.css`, and remember to set the `rel` attribute to `stylesheet`.
添加 `link` 元素以鏈接你的 `styles.css` 文件。 `href` 設置爲 `styles.css`,並記住將 `rel` 屬性設置爲 `stylesheet`
# --hints--

View File

@@ -28,7 +28,7 @@ const _callback = item => item * 2;
assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_callback)));
```
`["naomi", "quincy", "camperbot"].myMap(element => element.toUpperCase())` should return `["NAOMI", "QUINCY", "CAMPERBOT"]`.
`["naomi", "quincy", "camperbot"].myMap(element => element.toUpperCase())` 应该返回 `["NAOMI", "QUINCY", "CAMPERBOT"]`
```js
const _test_s = ["naomi", "quincy", "camperbot"];
@@ -36,7 +36,7 @@ const _callback = element => element.toUpperCase();
assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_callback)));
```
`[1, 1, 2, 5, 2].myMap((element, index, array) => array[index + 1] || array[0])` should return `[1, 2, 5, 2, 1]`.
`[1, 1, 2, 5, 2].myMap((element, index, array) => array[index + 1] || array[0])` 应该返回 `[1, 2, 5, 2, 1]`
```js
const _test_s = [1, 1, 2, 5, 2];
@@ -44,7 +44,7 @@ const _callback = (element, index, array) => array[index + 1] || array[0];
assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_callback)));
```
Your code should not use the `map` method.
你的代码不应该使用 `map` 方法。
```js
assert(!code.match(/\.?[\s\S]*?map/g));

View File

@@ -24,7 +24,7 @@ const _callback = item => item % 2;
assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFilter(_callback)));
```
`["naomi", "quincy", "camperbot"].myFilter(element => element === "naomi")` should return `["naomi"]`.
`["naomi", "quincy", "camperbot"].myFilter(element => element === "naomi")` 应该返回 `["naomi"]`
```js
const _test_s = ["naomi", "quincy", "camperbot"];
@@ -32,7 +32,7 @@ const _callback = element => element === "naomi";
assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFilter(_callback)));
```
`[1, 1, 2, 5, 2].myFilter((element, index, array) => array.indexOf(element) === index)` should return `[1, 2, 5]`.
`[1, 1, 2, 5, 2].myFilter((element, index, array) => array.indexOf(element) === index)` 应该返回 `[1, 2, 5]`
```js
const _test_s = [1, 1, 2, 5, 2];
@@ -40,7 +40,7 @@ const _callback = (element, index, array) => array.indexOf(element) === index;
assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFilter(_callback)));
```
Your code should not use the `filter` method.
你的代码不应该使用 `filter` 方法。
```js
assert(!code.match(/\.?[\s\S]*?filter/g));

View File

@@ -14,19 +14,19 @@ dashedName: exercise-tracker
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-project-exercisetracker" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 上的初始化项目</a>来完成你的项目。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit按照以下步骤设置项目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮.
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
当你完成后请将一个确保正常运行的demo项目演示托管在可以公开访问的平台上。 然后将 URL 提交到 `Solution Link` 中。 此外,还可以将项目的源码提交到 `GitHub Link` 中。
# --instructions--
Your responses should have the following structures.
你的答案应该有以下结构。
Exercise:
练习:
```js
{
@@ -38,7 +38,7 @@ Exercise:
}
```
User:
用户:
```js
{
@@ -47,7 +47,7 @@ User:
}
```
Log:
日志:
```js
{
@@ -62,11 +62,11 @@ Log:
}
```
**Hint:** For the `date` property, the `toDateString` method of the `Date` API can be used to achieve the expected output.
**提示:** 对于 `date` 属性,`Date` API 的 `toDateString` 方法可用于实现预期输出。
# --hints--
You should provide your own project, not the example URL.
你应该提交你自己的项目,而不是示例 URL
```js
(getUserInput) => {
@@ -77,7 +77,7 @@ You should provide your own project, not the example URL.
};
```
You can `POST` to `/api/users` with form data `username` to create a new user.
你可以将表单里的 `username` 通过 `POST` 请求发送到 `/api/users`,以创建一个新的用户。
```js
async (getUserInput) => {
@@ -94,7 +94,7 @@ async (getUserInput) => {
};
```
The returned response from `POST /api/users` with form data `username` will be an object with `username` and `_id` properties.
从包含 `username``POST /api/users` 请求返回的结果将是一个包含 `username` `_id` 属性的对象。
```js
async (getUserInput) => {
@@ -114,7 +114,7 @@ async (getUserInput) => {
};
```
You can make a `GET` request to `/api/users` to get a list of all users.
你可以向 `/api/users` 发出 `GET` 请求以获取所有用户的列表。
```js
async(getUserInput) => {
@@ -127,7 +127,7 @@ async(getUserInput) => {
};
```
The `GET` request to `/api/users` returns an array.
`/api/users``GET` 请求将返回一个数组。
```js
async(getUserInput) => {
@@ -142,7 +142,7 @@ async(getUserInput) => {
};
```
Each element in the array returned from `GET /api/users` is an object literal containing a user's `username` and `_id`.
`GET /api/users` 返回的数组中的每个元素都是一个对象字面量,包含用户的 `username` `_id`
```js
async(getUserInput) => {
@@ -162,7 +162,7 @@ async(getUserInput) => {
};
```
You can `POST` to `/api/users/:_id/exercises` with form data `description`, `duration`, and optionally `date`. If no date is supplied, the current date will be used.
你可以将表单里的 `description``duration``date`(可选)用 `POST` 发送请求到 `/api/users/:_id/exercises`。 如果没有传入 date默认采用当前日期。
```js
async (getUserInput) => {
@@ -196,7 +196,7 @@ async (getUserInput) => {
};
```
The response returned from `POST /api/users/:_id/exercises` will be the user object with the exercise fields added.
`POST /api/users/:_id/exercises` 返回的响应将是添加了运动字段的用户对象。
```js
async (getUserInput) => {
@@ -235,7 +235,7 @@ async (getUserInput) => {
};
```
You can make a `GET` request to `/api/users/:_id/logs` to retrieve a full exercise log of any user.
可以发送 `GET` 请求到 `/api/users/:_id/logs`,以获取任何用户的完整运动日志。
```js
async (getUserInput) => {
@@ -274,7 +274,7 @@ async (getUserInput) => {
};
```
A request to a user's log `GET /api/users/:_id/logs` returns a user object with a `count` property representing the number of exercises that belong to that user.
对用户日志的请求 `GET /api/users/:_id/logs` 返回一个用户对象,该对象具有一个 `count` 属性,表示属于该用户的运动次数。
```js
async (getUserInput) => {
@@ -315,7 +315,7 @@ async (getUserInput) => {
};
```
A `GET` request to `/api/users/:_id/logs` will return the user object with a `log` array of all the exercises added.
`/api/users/:_id/logs` `GET` 请求,将返回用户对象,其中包含添加的所有练习的 `log` 数组。
```js
async(getUserInput) => {
@@ -359,7 +359,7 @@ async(getUserInput) => {
};
```
Each item in the `log` array that is returned from `GET /api/users/:_id/logs` is an object that should have a `description`, `duration`, and `date` properties.
`GET /api/users/:_id/logs` 返回的 `log` 数组中的每个项目都是一个应该具有 `description``duration` `date` 属性的对象。
```js
async(getUserInput) => {
@@ -406,7 +406,7 @@ async(getUserInput) => {
};
```
The `description` property of any object in the `log` array that is returned from `GET /api/users/:_id/logs` should be a string.
`GET /api/users/:_id/logs` 返回的 `log` 数组中任何对象的 `description` 属性都应该是一个字符串。
```js
async(getUserInput) => {
@@ -453,7 +453,7 @@ async(getUserInput) => {
};
```
The `duration` property of any object in the `log` array that is returned from `GET /api/users/:_id/logs` should be a number.
`GET /api/users/:_id/logs` 返回的 `log` 数组中任何对象的 `duration` 属性应该是一个数字。
```js
async(getUserInput) => {
@@ -500,7 +500,7 @@ async(getUserInput) => {
};
```
The `date` property of any object in the `log` array that is returned from `GET /api/users/:_id/logs` should be a string. Use the `dateString` format of the `Date` API.
`GET /api/users/:_id/logs` 返回的 `log` 数组中任何对象的 `date` 属性应该是一个字符串。 使用 `Date` API 的 `dateString` 格式。
```js
async(getUserInput) => {
@@ -547,7 +547,7 @@ async(getUserInput) => {
};
```
You can add `from`, `to` and `limit` parameters to a `GET /api/users/:_id/logs` request to retrieve part of the log of any user. `from` and `to` are dates in `yyyy-mm-dd` format. `limit` is an integer of how many logs to send back.
你可以将 `from``to` `limit` 参数添加到 `GET /api/users/:_id/logs` 请求,检索任何用户的部分日志。 `from` `to` `yyyy-mm-dd` 形式的日期, `limit` 是一个整数,表示要送回多少份日志。
```js
async (getUserInput) => {

View File

@@ -14,21 +14,21 @@ dashedName: file-metadata-microservice
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-project-filemetadata" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 上的初始化项目</a>来完成你的项目。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit按照以下步骤设置项目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
当你完成后,请将一个确保正常运行的 demo项目演示托管在可以公开访问的平台上。 然后将 demo 的 URL 提交到 `Solution Link` 中。 此外,还可以将项目的源码链接提交到 `GitHub Link` 中。
# --instructions--
**HINT:** You can use the `multer` npm package to handle file uploading.
** 提示:**可以使用 `multer` npm 包来处理上传文件。
# --hints--
You should provide your own project, not the example URL.
你应该提交自己的项目,而不是示例的 URL
```js
(getUserInput) => {
@@ -40,7 +40,7 @@ You should provide your own project, not the example URL.
};
```
You can submit a form that includes a file upload.
你可以提交一个包含上传文件的表单。
```js
async (getUserInput) => {
@@ -51,7 +51,7 @@ async (getUserInput) => {
};
```
The form file input field has the `name` attribute set to `upfile`.
表单文件输入字段的 `name` 属性设置成 `upfile`
```js
async (getUserInput) => {
@@ -62,7 +62,7 @@ async (getUserInput) => {
};
```
When you submit a file, you receive the file `name`, `type`, and `size` in bytes within the JSON response.
当你提交一个文件时,在 JSON 响应中收到文件的 `name``type` `size`,以 bytes(字节)为单位。
```js
async (getUserInput) => {

View File

@@ -14,17 +14,17 @@ dashedName: request-header-parser-microservice
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-project-headerparser" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 上的初始化项目</a>来完成你的项目。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit请按照以下步骤设置项目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
当你完成后,请将一个确保正常运行的 demo项目演示托管在可以公开访问的平台上。 然后将 demo 的 URL 提交到 `Solution Link` 中。 此外,将项目的源码链接提交到 `GitHub Link` 字段中。
# --hints--
You should provide your own project, not the example URL.
你应该提交自己的项目,而不是示例的 URL
```js
(getUserInput) => {
@@ -36,7 +36,7 @@ You should provide your own project, not the example URL.
};
```
A request to `/api/whoami` should return a JSON object with your IP address in the `ipaddress` key.
`/api/whoami` 发送请求,返回一个 JSON 对象这个JSON 对象应该含有存放 IP 地址的 `ipaddress` 键。
```js
(getUserInput) =>
@@ -48,7 +48,7 @@ A request to `/api/whoami` should return a JSON object with your IP address in t
);
```
A request to `/api/whoami` should return a JSON object with your preferred language in the `language` key.
`/api/whoami` 发送请求,返回一个 JSON 对象,这个 JSON 对象应该含有存放语言首选项的 `language` 键。
```js
(getUserInput) =>
@@ -60,7 +60,7 @@ A request to `/api/whoami` should return a JSON object with your preferred langu
);
```
A request to `/api/whoami` should return a JSON object with your software in the `software` key.
`/api/whoami` 发送请求,返回一个 JSON 对象,这个 JSON 对象应该含有存放(发送请求的)软件的 `software` 键。
```js
(getUserInput) =>

View File

@@ -14,19 +14,19 @@ dashedName: timestamp-microservice
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-project-timestamp" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 上的初始化项目</a>来完成你的项目。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit请按照以下步骤设置项目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
当你完成后,请将一个确保正常运行的 demo项目演示托管在可以公开访问的平台上。 然后将 demo 的 URL 提交到 `Solution Link` 字段中。 此外,将项目的源码链接提交到 `GitHub Link` 字段中。
**Note:** Time zones conversion is not a purpose of this project, so assume all sent valid dates will be parsed with `new Date()` as GMT dates.
**注意:**时区转换不是本项目的目的,因此假设所有发送的有效日期将使用 `new Date()` 解析为 GMT 日期。
# --hints--
You should provide your own project, not the example URL.
你应该提交自己的项目,而不是示例的 URL
```js
(getUserInput) => {
@@ -36,7 +36,7 @@ You should provide your own project, not the example URL.
};
```
A request to `/api/:date?` with a valid date should return a JSON object with a `unix` key that is a Unix timestamp of the input date in milliseconds (as type Number)
一个对 `/api/:date?` 的有效日期的请求应该返回一个 JSON 对象,该对象的 `unix` 键是输入日期的 Unix 时间戳,单位是毫秒(数字类型)。
```js
(getUserInput) =>
@@ -54,7 +54,7 @@ A request to `/api/:date?` with a valid date should return a JSON object with a
);
```
A request to `/api/:date?` with a valid date should return a JSON object with a `utc` key that is a string of the input date in the format: `Thu, 01 Jan 1970 00:00:00 GMT`
对具有有效日期的 `/api/:date?` 的请求应返回一个带有 `utc` 键的 JSON 对象,该键是输入日期的字符串,格式为:`Thu, 01 Jan 1970 00:00:00 GMT`
```js
(getUserInput) =>
@@ -72,7 +72,7 @@ A request to `/api/:date?` with a valid date should return a JSON object with a
);
```
A request to `/api/1451001600000` should return `{ unix: 1451001600000, utc: "Fri, 25 Dec 2015 00:00:00 GMT" }`
`/api/1451001600000` 的请求应该返回 `{ unix: 1451001600000, utc: "Fri, 25 Dec 2015 00:00:00 GMT" }`
```js
(getUserInput) =>
@@ -89,7 +89,7 @@ A request to `/api/1451001600000` should return `{ unix: 1451001600000, utc: "Fr
);
```
Your project can handle dates that can be successfully parsed by `new Date(date_string)`
你的项目可以处理可以通过 `new Date(date_string)` 成功解析的日期。
```js
(getUserInput) =>
@@ -106,7 +106,7 @@ Your project can handle dates that can be successfully parsed by `new Date(date_
);
```
If the input date string is invalid, the api returns an object having the structure `{ error : "Invalid Date" }`
如果输入的日期字符串无效api 将返回一个具有结构 `{ error : "Invalid Date" }` 的对象。
```js
(getUserInput) =>
@@ -120,7 +120,7 @@ If the input date string is invalid, the api returns an object having the struct
);
```
An empty date parameter should return the current time in a JSON object with a `unix` key
一个空的日期参数应该返回一个带有 `unix` 键的 JSON 对象中的当前时间。
```js
(getUserInput) =>
@@ -135,7 +135,7 @@ An empty date parameter should return the current time in a JSON object with a `
);
```
An empty date parameter should return the current time in a JSON object with a `utc` key
一个空日期参数应返回带有 `utc` 键的 JSON 对象中的当前时间。
```js
(getUserInput) =>

View File

@@ -14,21 +14,21 @@ dashedName: url-shortener-microservice
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-project-urlshortener" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 上的初始化项目</a>来完成你的项目。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit请按照以下步骤设置项目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.
当你完成后,请将一个确保正常运行的 demo项目演示托管在可以公开访问的平台上。 然后将 demo 的 URL 提交到 `Solution Link` 字段中。 此外,将项目的源码链接提交到 `GitHub Link` 字段中。
# --instructions--
**HINT:** Do not forget to use a body parsing middleware to handle the POST requests. Also, you can use the function `dns.lookup(host, cb)` from the `dns` core module to verify a submitted URL.
**提示:**不要忘记使用 body parsing 中间件来处理 POST 请求。 也可以使用 `dns` 核心模块中的 `dns.lookup(host, cb)` 函数验证提交的 URL
# --hints--
You should provide your own project, not the example URL.
你应该提交自己的项目,而不是示例的 URL
```js
(getUserInput) => {
@@ -40,7 +40,7 @@ You should provide your own project, not the example URL.
};
```
You can POST a URL to `/api/shorturl` and get a JSON response with `original_url` and `short_url` properties. Here's an example: `{ original_url : 'https://freeCodeCamp.org', short_url : 1}`
可以通过 POST 请求给 `/api/shorturl` 发送一个 URL并返回一个带有 `original_url` `short_url` 属性的 JSON 响应。 例如:`{ original_url : 'https://freeCodeCamp.org', short_url : 1}`
```js
async (getUserInput) => {
@@ -62,7 +62,7 @@ async (getUserInput) => {
};
```
When you visit `/api/shorturl/<short_url>`, you will be redirected to the original URL.
当你访问 `/api/shorturl/<short_url>` 时,将重定向到原来的 URL
```js
async (getUserInput) => {
@@ -94,7 +94,7 @@ async (getUserInput) => {
};
```
If you pass an invalid URL that doesn't follow the valid `http://www.example.com` format, the JSON response will contain `{ error: 'invalid url' }`
如果你传入了一个无效的 URL 且没有遵循有效的 `http://www.example.com` 格式JSON 响应将包含 `{ error: 'invalid url' }`
```js
async (getUserInput) => {

View File

@@ -14,27 +14,27 @@ dashedName: meet-the-node-console
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-express" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 上的初始化项目</a>来完成这些挑战。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit请按照以下步骤设置项目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field.
当你完成后,请将一个确保正常运行的 demo项目演示托管在可以公开访问的平台上。 然后将 demo 的 URL 提交到 `Solution Link` 字段中。
During the development process, it is important to be able to check whats going on in your code.
在开发过程中,能够随时看到代码的运行结果是非常重要的。
Node is just a JavaScript environment. Like client side JavaScript, you can use the console to display useful debug information. On your local machine, you would see console output in a terminal. On Replit, a terminal is open in the right pane by default.
Node 只是一个 JavaScript 环境。 与客户端 JavaScript 一样,你可以使用控制台显示有用的调试信息。 在你的本地计算机上,你可以在终端中看到控制台输出。 在 Replit 上,右侧边栏会默认打开一个终端。
We recommend to keep the terminal open while working at these challenges. By reading the output in the terminal, you can see any errors that may occur.
我们建议在做这些挑战题时保持终端打开的状态。 通过阅读终端的输出,你可以看到可能发生的任何错误。
# --instructions--
Modify the `myApp.js` file to log "Hello World" to the console.
修改 `myApp.js` 文件,在控制台打印出 “Hello World”。
# --hints--
`"Hello World"` should be in the console
控制台应该输出 `"Hello World"`
```js
(getUserInput) =>

View File

@@ -14,19 +14,19 @@ dashedName: how-to-use-package-json-the-core-of-any-node-js-project-or-npm-packa
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-npm" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 上的初始化项目</a>来完成这些挑战。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit请按照以下步骤设置项目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field.
当你完成后,请将一个确保正常运行的 demo项目演示托管在可以公开访问的平台上。 然后将 demo 的 URL 提交到 `Solution Link` 字段中。
The `package.json` file is the center of any Node.js project or npm package. It stores information about your project, similar to how the &lt;head> section of an HTML document describes the content of a webpage. It consists of a single JSON object where information is stored in key-value pairs. There are only two required fields; "name" and "version", but its good practice to provide additional information about your project that could be useful to future users or maintainers.
`package.json` 文件是所有 Node.js 项目和 npm 包的枢纽, 和 HTML 文档中的 &lt;head> 部分用来描述网页的配置信息(元数据)一样,它存储你的项目的相关信息。 它由单个 JSON 对象组成,并以键值对的形式存储项目信息, 且至少包含两个必填字段“name” 和 “version”——但是最好提供有关项目的其他信息这将对用户或者维护者有所帮助。
If you look at the file tree of your project, you will find the package.json file on the top level of the tree. This is the file that you will be improving in the next couple of challenges.
如果你能找到项目的文件树,那么可以在文件树的最外层找到 package.json 在接下来的几个挑战中你将完善这个文件。
One of the most common pieces of information in this file is the `author` field. It specifies who created the project, and can consist of a string or an object with contact or other details. An object is recommended for bigger projects, but a simple string like the following example will do for this project.
在这个文件中最常见的信息之一是 `author` 字段, 它说明了项目的创建者,可以包含一个带有联系人信息或其他信息的字符串或对象。 对于较大的项目,建议使用对象;但是在我们的项目中,一个简单的字符串就够了,比如下面的例子:
```json
"author": "Jane Doe",
@@ -34,13 +34,13 @@ One of the most common pieces of information in this file is the `author` field.
# --instructions--
Add your name as the `author` of the project in the package.json file.
在 package.json 文件中加入你的名字作为项目的 `author`
**Note:** Remember that youre writing JSON, so all field names must use double-quotes (") and be separated with a comma (,).
**注意:**你正在写 JSON所有的字段名必须用双引号")包裹,也必须用逗号(,)分割。
# --hints--
package.json should have a valid "author" key
package.json 应该有一个有效的 “author” 键。
```js
(getUserInput) =>

View File

@@ -14,25 +14,25 @@ dashedName: install-and-set-up-mongoose
- 使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-mongomongoose" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 上的初始化项目</a>来完成这些挑战。
- 使用你选择的网站生成器来完成项目。 需要包含我们 GitHub 仓库的所有文件。
If you use Replit, follow these steps to set up the project:
如果你使用 Replit请按照以下步骤设置项目
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field.
当你完成后,请将一个确保正常运行的 demo项目演示托管在可以公开访问的平台上。 然后将 demo 的 URL 提交到 `Solution Link` 字段中。
In this challenge, you will set up a MongoDB Atlas database and import the required packages to connect to it.
在这个挑战中,你将建立一个 MongoDB Atlas 数据库并导入连接到它所需的软件包。
Follow <a href='https://www.freecodecamp.org/news/get-started-with-mongodb-atlas/' target="_blank" rel="noopener noreferrer nofollow">this tutorial</a> to set up a hosted database on MongoDB Atlas.
按照<a href='https://https://www.freecodecamp.org/chinese/news/get-started-with-mongodb-atlas/' target="_blank" rel="noopener noreferrer nofollow">这篇教程</a>在 MongoDB Atlas 创建一个托管数据库。
# --instructions--
`mongoose@^5.11.15` has been added to your projects `package.json` file. First, require mongoose as `mongoose` in `myApp.js`. Next, create a `.env` file and add a `MONGO_URI` variable to it. Its value should be your MongoDB Atlas database URI. Be sure to surround the URI with single or double quotes, and remember that you can't use spaces around the `=` in environment variables. For example, `MONGO_URI='VALUE'`.
`mongoose@^5.11.15` 已添加到你项目的 `package.json` 文件中。 首先,在 `myApp.js` 中请求 mongoose `mongoose`。 接下来,创建一个 `.env` 文件并向其中添加一个 `MONGO_URI` 变量。 变量的值为你的 MongoDB Atlas 数据库 URI。 应用单引号或双引号包裹 URI。请记住环境变量 `=` 两边不能有空格。 例如,`MONGO_URI='VALUE'`
**Note:** If you are using Replit, you cannot create a `.env` file. Instead, use the built-in <dfn>SECRETS</dfn> tab to add the variable. <em>Do not</em> surround the values with quotes when using the <em>SECRETS</em> tab.
**注意:**如果你使用的是 Replit则无法创建 `.env` 文件。 相反,使用内置的 <dfn>SECRETS</dfn> 选项卡来添加变量。 在使用 <em>SECRETS</em> 选项卡时,<em>不要</em>将值括在引号中。
When you are done, connect to the database using the following syntax:
完成后,使用以下语法连接到数据库:
```js
mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true });
@@ -40,7 +40,7 @@ mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true }
# --hints--
"mongoose version ^5.11.15" dependency should be in package.json
mongoose version ^5.11.15” 依赖项应该在 package.json 中。
```js
(getUserInput) =>
@@ -60,7 +60,7 @@ mongoose.connect(<Your URI>, { useNewUrlParser: true, useUnifiedTopology: true }
);
```
"mongoose" should be connected to a database
应使用 “mongoose” 连接数据库。
```js
(getUserInput) =>

View File

@@ -10,9 +10,9 @@ dashedName: arithmetic-formatter
你将使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-arithmetic-formatter" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 的初始化项目</a>来完成这个项目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
# --instructions--
@@ -63,16 +63,16 @@ arithmetic_arranger(["32 + 8", "1 - 3801", "9999 + 9999", "523 - 49"], True)
如果提供的问题格式正确,该函数将返回正确的转换,否则,它将 **返回** 一个 **字符串** 来描述对用户有意义的错误。
- Situations that will return an error:
- If there are **too many problems** supplied to the function. The limit is **five**, anything more will return: `Error: Too many problems.`
- The appropriate operators the function will accept are **addition** and **subtraction**. Multiplication and division will return an error. Other operators not mentioned in this bullet point will not need to be tested. The error returned will be: `Error: Operator must be '+' or '-'.`
- Each number (operand) should only contain digits. Otherwise, the function will return: `Error: Numbers must only contain digits.`
- Each operand (aka number on each side of the operator) has a max of four digits in width. Otherwise, the error string returned will be: `Error: Numbers cannot be more than four digits.`
- If the user supplied the correct format of problems, the conversion you return will follow these rules:
- There should be a single space between the operator and the longest of the two operands, the operator will be on the same line as the second operand, both operands will be in the same order as provided (the first will be the top one and the second will be the bottom).
- Numbers should be right-aligned.
- There should be four spaces between each problem.
- There should be dashes at the bottom of each problem. The dashes should run along the entire length of each problem individually. (The example above shows what this should look like.)
- 会返回错误的情况:
- 如果提供给函数的**问题过多**。 限制为**五个**,更多的将返回:`Error: Too many problems.`
- 函数可以接受的运算符是**加法**和**减法**。 乘法和除法将返回错误。 本要点中未提及的其他运算符将不需要进行测试。 返回的错误将是:`Error: Operator must be '+' or '-'.`
- 每个数字(操作数)应该只包含数字。 否则,该函数将返回:`Error: Numbers must only contain digits.`
- 每个操作数(即运算符每一侧的数字)的宽度最多为四位数字。 否则,返回的错误字符串将为:`Error: Numbers cannot be more than four digits.`
- 如果用户提供了正确格式的问题,返回的转换将遵循以下规则:
- 操作符和两个操作数中最长的一个之间应该有一个空格,操作符将与第二个操作数在同一行,两个操作数的顺序与提供的相同(第一个是上面的,第二个是下面的)。
- 数字应该右对齐。
- 每个问题之间应该有四个空格。
- 每个问题的底部都应该有破折号。 破折号应该单独沿着每个问题的整个长度延伸。 (上面的例子展示了这应该是什么样子。)
## 开发

View File

@@ -10,26 +10,26 @@ dashedName: budget-app
你将使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-budget-app" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 的初始化项目</a>来完成这个项目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
# --instructions--
完成 `budget.py` 中的 `Category` 类。 它应该能够根据不同的预算类别实例化对象,例如 *食物**服装**娱乐* 。 创建对象时,它们以类别的名称传递。 该类应该有一个名为 `ledger` 的实例变量,它是一个列表。 该类还应包含以下方法:
- A `deposit` method that accepts an amount and description. If no description is given, it should default to an empty string. The method should append an object to the ledger list in the form of `{"amount": amount, "description": description}`.
- A `withdraw` method that is similar to the `deposit` method, but the amount passed in should be stored in the ledger as a negative number. If there are not enough funds, nothing should be added to the ledger. This method should return `True` if the withdrawal took place, and `False` otherwise.
- A `get_balance` method that returns the current balance of the budget category based on the deposits and withdrawals that have occurred.
- A `transfer` method that accepts an amount and another budget category as arguments. The method should add a withdrawal with the amount and the description "Transfer to [Destination Budget Category]". The method should then add a deposit to the other budget category with the amount and the description "Transfer from [Source Budget Category]". If there are not enough funds, nothing should be added to either ledgers. This method should return `True` if the transfer took place, and `False` otherwise.
- A `check_funds` method that accepts an amount as an argument. It returns `False` if the amount is greater than the balance of the budget category and returns `True` otherwise. This method should be used by both the `withdraw` method and `transfer` method.
- 接受金额和描述的 `deposit` 方法。 如果没有给出描述,它应该默认为一个空字符串。 该方法应以 `{"amount": amount, "description": description}` 的形式将对象附加到账本列表。
- `withdraw` 方法类似于 `deposit` 方法,但传入的金额应作为负数存储在账本中。 如果没有足够的资金,则不应向账本添加任何内容。 如果取款发生,此方法应返回 `True`,否则返回 `False`
- `get_balance` 方法,根据发生的存款和取款返回预算类别的当前余额。
- `transfer` 方法,它接受一个金额和另一个预算类别作为参数。 该方法应添加带有金额和描述 “Transfer to [目的地预算类别]”的提款。 然后,该方法应将存款添加到其他预算类别,其金额和描述为 “Transfer from [来源预算类别]”。 如果没有足够的资金,则不应向任一账本添加任何内容。 如果转账发生,此方法应返回 `True`,否则返回 `False`
- 接受金额作为参数的 `check_funds` 方法。 如果金额大于预算类别的余额,则返回 `False`,否则返回 `True` `withdraw` 方法和 `transfer` 方法都应该使用此方法。
打印预算对象时,它应显示:
- A title line of 30 characters where the name of the category is centered in a line of `*` characters.
- A list of the items in the ledger. Each line should show the description and amount. The first 23 characters of the description should be displayed, then the amount. The amount should be right aligned, contain two decimal places, and display a maximum of 7 characters.
- A line displaying the category total.
- 30 个字符的标题行,类别名称居中在一行 `*` 字符中。
- 账本中的项目列表。 每行应显示描述和金额。 应显示描述的前 23 个字符,然后是金额。 金额应右对齐,包含两位小数,最多显示 7 个字符。
- 一行显示类别总数。
下面是一个输出示例:

View File

@@ -10,9 +10,9 @@ dashedName: polygon-area-calculator
你将使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-polygon-area-calculator" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 的初始化项目</a>来完成这个项目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
# --instructions--
@@ -25,11 +25,11 @@ dashedName: polygon-area-calculator
- `set_width`
- `set_height`
- `get_area`: Returns area (`width * height`)
- `get_perimeter`: Returns perimeter (`2 * width + 2 * height`)
- `get_diagonal`: Returns diagonal (`(width ** 2 + height ** 2) ** .5`)
- `get_picture`: Returns a string that represents the shape using lines of "\*". The number of lines should be equal to the height and the number of "\*" in each line should be equal to the width. There should be a new line (`\n`) at the end of each line. If the width or height is larger than 50, this should return the string: "Too big for picture.".
- `get_amount_inside`: Takes another shape (square or rectangle) as an argument. Returns the number of times the passed in shape could fit inside the shape (with no rotations). For instance, a rectangle with a width of 4 and a height of 8 could fit in two squares with sides of 4.
- `get_area`:返回面积(`width * height`
- `get_perimeter`:返回周长(`2 * width + 2 * height`
- `get_diagonal`:返回对角线(`(width ** 2 + height ** 2) ** .5`
- `get_picture`:返回一个字符串,该字符串使用包含 “\*” 的行来表示形状。 行数应等于高度,每行中 “\*” 的数量应等于宽度。 每行末尾应该有一个新行(`\n`)。 如果宽度或高度大于 50则应返回字符串Too big for picture.”。
- `get_amount_inside`:以另一个形状(正方形或矩形)作为参数。 返回传入的形状可以装进该形状的次数(没有旋转)。 例如,一个宽为 4、高为 8 的矩形可以放入两个边长为 4 的正方形。
另外,如果一个 Rectangle 实例被表示为一个字符串,它应该看起来像: `Rectangle(width=5, height=10)`

View File

@@ -10,9 +10,9 @@ dashedName: probability-calculator
你将使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-probability-calculator" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 的初始化项目</a>来完成这个项目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
# --instructions--
@@ -35,10 +35,10 @@ hat3 = Hat(red=5, orange=4, black=1, blue=0, pink=2, striped=9)
接下来,在 `prob_calculator.py`(不是在 `Hat` 类中)创建一个 `experiment` 函数。 此函数应接受以下参数:
- `hat`: A hat object containing balls that should be copied inside the function.
- `expected_balls`: An object indicating the exact group of balls to attempt to draw from the hat for the experiment. For example, to determine the probability of drawing 2 blue balls and 1 red ball from the hat, set `expected_balls` to `{"blue":2, "red":1}`.
- `num_balls_drawn`: The number of balls to draw out of the hat in each experiment.
- `num_experiments`: The number of experiments to perform. (The more experiments performed, the more accurate the approximate probability will be.)
- `hat`:一个包含球的帽子对象,应该在函数内复制。
- `expected_balls`:一个对象,指示尝试从帽子中抽取的确切球组以进行实验。 例如,要确定从帽子中抽取 2 个蓝球和 1 个红球的概率,将 `expected_balls` 设置为 `{"blue":2, "red":1}`
- `num_balls_drawn`:每次实验中从帽子中抽出的球数。
- `num_experiments`:要执行的实验数量。 (进行的实验越多,近似概率就越准确。)
`experiment` 函数应该返回一个概率。

View File

@@ -10,17 +10,17 @@ dashedName: time-calculator
你将使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-time-calculator" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 的初始化项目</a>来完成这个项目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
# --instructions--
编写一个名为 `add_time` 的函数,它接受两个必需参数和一个可选参数:
- a start time in the 12-hour clock format (ending in AM or PM)
- a duration time that indicates the number of hours and minutes
- (optional) a starting day of the week, case insensitive
- 12 小时制的开始时间(以 AM PM 结束)
- 指示小时数和分钟数的持续时间
- (可选)一周的开始日期,不区分大小写
该函数应将持续时间添加到开始时间并返回结果。

View File

@@ -10,16 +10,16 @@ dashedName: demographic-data-analyzer
你将使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-demographic-data-analyzer" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 的初始化项目</a>来完成这个项目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
我们仍在开发 Python 课程的交互式教学部分。 目前,你可以在 YouTube 上通过 freeCodeCamp.org 上传的一些视频学习这个项目相关的知识。
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a> (14 hours)
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">给所有人的 Python 课程</a>14 小时)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">How to Analyze Data with Python Pandas</a> (10 hours)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">如何使用 Python Pandas 分析数据</a>10 小时)
# --instructions--
@@ -37,15 +37,15 @@ dashedName: demographic-data-analyzer
你必须使用 Pandas 来回答以下问题:
- How many people of each race are represented in this dataset? This should be a Pandas series with race names as the index labels. (`race` column)
- What is the average age of men?
- What is the percentage of people who have a Bachelor's degree?
- What percentage of people with advanced education (`Bachelors`, `Masters`, or `Doctorate`) make more than 50K?
- What percentage of people without advanced education make more than 50K?
- What is the minimum number of hours a person works per week?
- What percentage of the people who work the minimum number of hours per week have a salary of more than 50K?
- What country has the highest percentage of people that earn >50K and what is that percentage?
- Identify the most popular occupation for those who earn >50K in India.
- 这个数据集中每个种族有多少人? 这应该是一个以种族名称作为索引标签的 Pandas 系列。 `race` 栏)
- 男性的平均年龄是多少?
- 拥有学士学位的人的百分比是多少?
- 受过高等教育(`Bachelors``Masters` `Doctorate`)且收入超过 50K 的人占多大比例?
- 没有受过高等教育且收入超过 50K 的人的比例是多少?
- 一个人每周最少工作多少小时?
- 每周工作最少小时数的人中有多少人的工资超过 50K
- 哪个国家/地区的收入 >50K 的人口比例最高,该比例是多少?
- 找出印度收入 >50K 的人最受欢迎的职业。
使用文件 `demographic_data_analyzer` 中的启动代码。 更新代码以便将所有设置为“None”的变量设置为适当的计算或代码。 将所有小数四舍五入到最接近的十分之一。

View File

@@ -10,16 +10,16 @@ dashedName: mean-variance-standard-deviation-calculator
你将使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-mean-variance-standard-deviation-calculator" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 的初始化项目</a>来完成这个项目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
我们仍在开发 Python 课程的交互式教学部分。 目前,你可以在 YouTube 上通过 freeCodeCamp.org 上传的一些视频学习这个项目相关的知识。
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a>(14 hours)
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">给所有人的 Python 课程</a>14 小时)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">How to Analyze Data with Python Pandas</a> (10 hours)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">如何使用 Python Pandas 分析数据</a>10 小时)
# --instructions--

View File

@@ -10,16 +10,16 @@ dashedName: medical-data-visualizer
你将使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-medical-data-visualizer" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 的初始化项目</a>来完成这个项目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
我们仍在开发 Python 课程的交互式教学部分。 目前,你可以在 YouTube 上通过 freeCodeCamp.org 上传的一些视频学习这个项目相关的知识。
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a>(14 hours)
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">给所有人的 Python 课程</a>14 小时)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">How to Analyze Data with Python Pandas</a> (10 hours)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">如何使用 Python Pandas 分析数据</a>10 小时)
# --instructions--
@@ -52,16 +52,16 @@ dashedName: medical-data-visualizer
`medical_data_visualizer.py` 中使用数据完成以下任务:
- Add an `overweight` column to the data. To determine if a person is overweight, first calculate their BMI by dividing their weight in kilograms by the square of their height in meters. If that value is > 25 then the person is overweight. Use the value 0 for NOT overweight and the value 1 for overweight.
- Normalize the data by making 0 always good and 1 always bad. If the value of `cholesterol` or `gluc` is 1, make the value 0. If the value is more than 1, make the value 1.
- Convert the data into long format and create a chart that shows the value counts of the categorical features using seaborn's `catplot()`. The dataset should be split by 'Cardio' so there is one chart for each `cardio` value. The chart should look like `examples/Figure_1.png`.
- Clean the data. Filter out the following patient segments that represent incorrect data:
- diastolic pressure is higher than systolic (Keep the correct data with `(df['ap_lo'] <= df['ap_hi'])`)
- height is less than the 2.5th percentile (Keep the correct data with `(df['height'] >= df['height'].quantile(0.025))`)
- height is more than the 97.5th percentile
- weight is less than the 2.5th percentile
- weight is more than the 97.5th percentile
- Create a correlation matrix using the dataset. Plot the correlation matrix using seaborn's `heatmap()`. Mask the upper triangle. The chart should look like `examples/Figure_2.png`.
- 给数据添加一列 `overweight`。 要确定一个人是否超重,首先通过将他们的体重(公斤)除以他们的身高(米)的平方来计算他们的 BMI。 如果该值是 > 25则此人超重。 使用值 0 表示不超重,使用值 1 表示超重。
- 使用 0 表示好的和 1 表示坏,来规范化数据。 如果 `cholesterol` `gluc` 的值为 1则将值设为 0。 如果值大于 1则将值设为 1
- 将数据转换为长格式并使用 seaborn `catplot()` 创建一个显示分类特征值计数的图表。 数据集应按 “Cardio” 拆分,因此每个 `cardio` 值都有一个图表。 该图表应该看起来像 `examples/Figure_1.png`
- 清理数据。 过滤掉以下代表不正确数据的患者段:
- 舒张压高于收缩压(使用 `(df['ap_lo'] <= df['ap_hi'])` 保留正确的数据)
- 高度小于第 2.5 个百分位数(使用 `(df['height'] >= df['height'].quantile(0.025))` 保留正确的数据)
- 身高超过第 97.5 个百分位
- 体重小于第 2.5 个百分位
- 体重超过第 97.5 个百分位
- 使用数据集创建相关矩阵。 使用 seaborn 的 `heatmap()` 绘制相关矩阵。 遮罩上三角。 该图表应类似于 `examples/Figure_2.png`
每当变量设置为 `None` 时,请确保将其设置为正确的代码。

View File

@@ -10,16 +10,16 @@ dashedName: page-view-time-series-visualizer
你将使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-page-view-time-series-visualizer" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 的初始化项目</a>来完成这个项目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
我们仍在开发 Python 课程的交互式教学部分。 目前,你可以在 freeCodeCamp.org 的 YouTube 频道中通过视频学习到这个项目相关的所有知识
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a>(14 hours)
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">给所有人的 Python 课程</a>14 小时)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">How to Analyze Data with Python Pandas</a> (10 hours)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">如何使用 Python Pandas 分析数据</a>10 小时)
# --instructions--
@@ -27,11 +27,11 @@ dashedName: page-view-time-series-visualizer
使用数据完成以下任务:
- Use Pandas to import the data from "fcc-forum-pageviews.csv". Set the index to the `date` column.
- Clean the data by filtering out days when the page views were in the top 2.5% of the dataset or bottom 2.5% of the dataset.
- Create a `draw_line_plot` function that uses Matplotlib to draw a line chart similar to "examples/Figure_1.png". The title should be `Daily freeCodeCamp Forum Page Views 5/2016-12/2019`. The label on the x axis should be `Date` and the label on the y axis should be `Page Views`.
- Create a `draw_bar_plot` function that draws a bar chart similar to "examples/Figure_2.png". It should show average daily page views for each month grouped by year. The legend should show month labels and have a title of `Months`. On the chart, the label on the x axis should be `Years` and the label on the y axis should be `Average Page Views`.
- Create a `draw_box_plot` function that uses Seaborn to draw two adjacent box plots similar to "examples/Figure_3.png". These box plots should show how the values are distributed within a given year or month and how it compares over time. The title of the first chart should be `Year-wise Box Plot (Trend)` and the title of the second chart should be `Month-wise Box Plot (Seasonality)`. Make sure the month labels on bottom start at `Jan` and the x and y axis are labeled correctly. The boilerplate includes commands to prepare the data.
- 使用 Pandas 从 “fcc-forum-pageviews.csv” 导入数据。 将索引设置为 `date` 列。
- 通过过滤掉页面浏览量位于数据集前 2.5% 或数据集后 2.5% 的日期来清理数据。
- 创建一个 `draw_line_plot` 函数,该函数使用 Matplotlib 绘制类似于 “examples/Figure_1.png” 的折线图。 标题应为 `Daily freeCodeCamp Forum Page Views 5/2016-12/2019`。 x 轴上的标签应为 `Date`y 轴上的标签应为 `Page Views`
- 创建一个 `draw_bar_plot` 函数,用于绘制类似于 “examples/Figure_2.png” 的条形图。 它应该显示按年份分组的每个月的平均每日页面浏览量。 图例应显示月份标签并具有 `Months` 标题。 在图表上x 轴上的标签应为 `Years`y 轴上的标签应为 `Average Page Views`
- 创建一个 `draw_box_plot` 函数,该函数使用 Seaborn 绘制两个相邻的箱形图,类似于 “examples/Figure_3.png”。 这些箱线图应显示值在给定年份或月份内的分布情况以及随时间推移的比较情况。 第一个图表的标题应为 `Year-wise Box Plot (Trend)`,第二个图表的标题应为 `Month-wise Box Plot (Seasonality)`。 确保底部的月份标签从 `Jan` 开始,并且 x 和 y 轴标记正确。 样板文件包括准备数据的命令。
对于每个图表,请确保使用数据框的副本。 单元测试是在 `test_module.py` 下为你编写的。

View File

@@ -10,16 +10,16 @@ dashedName: sea-level-predictor
你将使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-sea-level-predictor" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 的初始化项目</a>来完成这个项目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
我们仍在开发 Python 课程的交互式教学部分。 目前,你可以在 YouTube 上通过 freeCodeCamp.org 上传的一些视频学习这个项目相关的知识。
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">Python for Everybody Video Course</a>(14 hours)
- <a href="https://www.freecodecamp.org/news/python-for-everybody/" target="_blank" rel="noopener noreferrer nofollow">给所有人的 Python 课程</a>14 小时)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">How to Analyze Data with Python Pandas</a> (10 hours)
- <a href="https://www.freecodecamp.org/news/how-to-analyze-data-with-python-pandas/" target="_blank" rel="noopener noreferrer nofollow">如何使用 Python Pandas 分析数据</a>10 小时)
# --instructions--
@@ -27,11 +27,11 @@ dashedName: sea-level-predictor
使用数据完成以下任务:
- Use Pandas to import the data from `epa-sea-level.csv`.
- Use matplotlib to create a scatter plot using the `Year` column as the x-axis and the `CSIRO Adjusted Sea Level` column as the y-axix.
- Use the `linregress` function from `scipy.stats` to get the slope and y-intercept of the line of best fit. Plot the line of best fit over the top of the scatter plot. Make the line go through the year 2050 to predict the sea level rise in 2050.
- Plot a new line of best fit just using the data from year 2000 through the most recent year in the dataset. Make the line also go through the year 2050 to predict the sea level rise in 2050 if the rate of rise continues as it has since the year 2000.
- The x label should be `Year`, the y label should be `Sea Level (inches)`, and the title should be `Rise in Sea Level`.
- 使用 Pandas `epa-sea-level.csv` 导入数据。
- 使用 matplotlib 创建散点图,将 `Year` 列作为 x 轴,将 `CSIRO Adjusted Sea Level` 列作为 y 轴。
- 使用 `scipy.stats` 中的 `linregress` 函数来获得最佳拟合线的斜率和 y 截距。 在散点图的顶部绘制最佳拟合线。 使线穿过 2050 年以预测 2050 年的海平面上升。
- 仅使用数据集中从 2000 年到最近一年的数据绘制一条新的最佳拟合线。 如果上升速度继续与 2000 年一样,则使该线也经过 2050 年以预测 2050 年的海平面上升。
- x 标签应为 `Year`y 标签应为 `Sea Level (inches)`,标题应为 `Rise in Sea Level`
单元测试是在 `test_module.py` 下为你编写的。

View File

@@ -12,9 +12,9 @@ dashedName: rock-paper-scissors
你将使用<a href="https://replit.com/github/freeCodeCamp/boilerplate-rock-paper-scissors" target="_blank" rel="noopener noreferrer nofollow">我们在 Replit 的初始化项目</a>来完成这个项目。
- Start by importing the project on Replit.
- Next, you will see a `.replit` window.
- Select `Use run command` and click the `Done` button.
- 首先在 Replit 中导入项目。
- 接着,你将看到一个 `.replit` 窗口。
- 选择 `Use run command` 并点击 `Done` 按钮。
我们仍在开发机器学习课程的交互式课程部分。 现在,你需要使用其他资源来学习如何通过这一挑战。
@@ -36,9 +36,9 @@ dashedName: rock-paper-scissors
要测试你的代码,请使用 `play` 函数玩游戏。 `play` 函数有四个参数:
- two players to play against each other (the players are actually functions)
- the number of games to play in the match
- an optional argument to see a log of each game. Set it to `True` to see these messages.
- 两个玩家互相对战(玩家实际上是函数)
- 对战中的比赛场数
- 一个可选参数来查看每场比赛的日志。 将其设置为 `True` 以查看这些消息。
```py
play(player1, player2, num_games[, verbose])

View File

@@ -7,7 +7,7 @@ dashedName: step-75
# --description--
In some browsers, the _heart_ emoji may look slightly different from the previous step. 这是因为字符的某些属性被 `font-weight``bold` 样式覆盖。
在某些浏览器中, _爱心_ emoji 表情可能与上一步略有不同。 这是因为字符的某些属性被 `font-weight``bold` 样式覆盖。
要修复这个问题,需要定位心形表情符号的 `div` 并将其 `font-weight` 设置为其原始值。

View File

@@ -9,7 +9,7 @@ dashedName: step-7
在开始为你添加的 `div` 设置样式之前,你需要将 CSS 链接到 HTML。
添加 `link` 元素以链接你的 `styles.css` 文件。 Set the `href` to `styles.css`, and remember to set the `rel` attribute to `stylesheet`.
添加 `link` 元素以链接你的 `styles.css` 文件。 `href` 设置为 `styles.css`,并记住将 `rel` 属性设置为 `stylesheet`
# --hints--

View File

@@ -36,7 +36,7 @@ const _callback = element => element.toUpperCase();
assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_callback)));
```
`[1, 1, 2, 5, 2].myMap((element, index, array) => array[index + 1] || array[0])` should return `[1, 2, 5, 2, 1]`.
`[1, 1, 2, 5, 2].myMap((element, index, array) => array[index + 1] || array[0])` dovrebbe restituire `[1, 2, 5, 2, 1]`.
```js
const _test_s = [1, 1, 2, 5, 2];

View File

@@ -25,7 +25,7 @@ dashedName: build-a-product-landing-page
1. Dentro il modulo, dovrebbe esserci un `input` per inviare il modulo con un corrispondente `id="submit"`
1. Cliccando l'elemento `#submit`, l'email dovrebbe essere inviata a una pagina statica (usa l'URL non funzionante: `https://www.freecodecamp.com/email-submit`)
1. La barra di navigazione dovrebbe essere sempre in cima al viewport
1. La landing page dovrebbe avere almeno un media query
1. La landing page dovrebbe avere almeno una media query
1. La landing page dovrebbe utilizzare CSS flexbox almeno una volta
Soddisfa le user story e supera tutti i test qui sotto per completare questo progetto. Usa il tuo stile personale. Buon divertimento!
@@ -154,7 +154,7 @@ const els = document.querySelectorAll('#form #email')
assert(els.length > 0)
```
L'elemento `#email`dovrebbe avere un attributo `placeholder` con del testo segnaposto.
L'elemento `#email` dovrebbe avere un attributo `placeholder` con del testo segnaposto.
```js
const el = document.getElementById('email')

View File

@@ -26,7 +26,7 @@ dashedName: build-a-personal-portfolio-webpage
上記のユーザーストーリーを満たし、以下のすべてのテストが通るようにして、このプロジェクトを完成させてください。 あなた独自のスタイルを加えましょう。 ハッピーコーディング!
**注:** スタイルシートをリンクして CSS を適用するため、HTML 内に `<link rel="stylesheet" href="styles.css">`必ず追加してください
**注:** スタイルシートをリンクして CSS を適用するため、HTML のコード内に必ず `<link rel="stylesheet" href="styles.css">` を追加してください
# --hints--

View File

@@ -30,7 +30,7 @@ dashedName: build-a-product-landing-page
上記のユーザーストーリーを満たし、以下のすべてのテストが通るようにして、このプロジェクトを完成させてください。 あなた独自のスタイルを加えましょう。 ハッピーコーディング!
**注:** スタイルシートをリンクして CSS を適用するため、HTML 内に `<link rel="stylesheet" href="styles.css">`必ず追加してください
**注:** スタイルシートをリンクして CSS を適用するため、HTML のコード内に必ず `<link rel="stylesheet" href="styles.css">` を追加してください
# --hints--

View File

@@ -31,7 +31,7 @@ dashedName: build-a-survey-form
上記のユーザーストーリーを満たし、以下のすべてのテストが通るようにして、このプロジェクトを完成させてください。 あなた独自のスタイルを加えましょう。 ハッピーコーディング!
**注:** スタイルシートをリンクして CSS を適用するため、HTML 内に `<link rel="stylesheet" href="styles.css">`必ず追加してください
**注:** スタイルシートをリンクして CSS を適用するため、HTML のコード内に必ず `<link rel="stylesheet" href="styles.css">` を追加してください
# --hints--

View File

@@ -30,7 +30,7 @@ dashedName: build-a-technical-documentation-page
上記のユーザーストーリーを満たし、以下のすべてのテストが通るようにして、このプロジェクトを完成させてください。 あなた独自のスタイルを加えましょう。 ハッピーコーディング!
**注:** スタイルシートをリンクして CSS を適用するため、HTML 内に `<link rel="stylesheet" href="styles.css">`必ず追加してください
**注:** スタイルシートをリンクして CSS を適用するため、HTML のコード内に必ず `<link rel="stylesheet" href="styles.css">` を追加してください
# --hints--

View File

@@ -24,7 +24,7 @@ dashedName: build-a-tribute-page
上記のユーザーストーリーを満たし、以下のすべてのテストが通るようにして、このプロジェクトを完成させてください。 あなた独自のスタイルを加えましょう。 ハッピーコーディング!
**注:** スタイルシートをリンクして CSS を適用するため、HTML 内に `<link rel="stylesheet" href="styles.css">`必ず追加してください
**注:** スタイルシートをリンクして CSS を適用するため、HTML のコード内に必ず `<link rel="stylesheet" href="styles.css">` を追加してください
# --hints--

View File

@@ -26,7 +26,7 @@ dashedName: build-a-personal-portfolio-webpage
上記のユーザーストーリーを満たし、以下のすべてのテストが通るようにして、このプロジェクトを完成させてください。 あなた独自のスタイルを加えましょう。 ハッピーコーディング!
**注:** スタイルシートをリンクして CSS を適用するため、HTML 内に `<link rel="stylesheet" href="styles.css">`必ず追加してください
**注:** スタイルシートをリンクして CSS を適用するため、HTML のコード内に必ず `<link rel="stylesheet" href="styles.css">` を追加してください
# --hints--

View File

@@ -30,7 +30,7 @@ dashedName: build-a-product-landing-page
上記のユーザーストーリーを満たし、以下のすべてのテストが通るようにして、このプロジェクトを完成させてください。 あなた独自のスタイルを加えましょう。 ハッピーコーディング!
**注:** スタイルシートをリンクして CSS を適用するため、HTML 内に `<link rel="stylesheet" href="styles.css">`必ず追加してください
**注:** スタイルシートをリンクして CSS を適用するため、HTML のコード内に必ず `<link rel="stylesheet" href="styles.css">` を追加してください
# --hints--

View File

@@ -31,7 +31,7 @@ dashedName: build-a-survey-form
上記のユーザーストーリーを満たし、以下のすべてのテストが通るようにして、このプロジェクトを完成させてください。 あなた独自のスタイルを加えましょう。 ハッピーコーディング!
**注:** スタイルシートをリンクして CSS 適用されるように、`<link rel="stylesheet" href="styles.css">` HTML 内に必ず加えてください。
**注:** スタイルシートをリンクして CSS 適用するため、HTML のコード内に必ず `<link rel="stylesheet" href="styles.css">`追加してください。
# --hints--

View File

@@ -30,7 +30,7 @@ dashedName: build-a-technical-documentation-page
上記のユーザーストーリーを満たし、以下のすべてのテストが通るようにして、このプロジェクトを完成させてください。 あなた独自のスタイルを加えましょう。 ハッピーコーディング!
**注:** スタイルシートをリンクして CSS を適用するため、HTML 内に `<link rel="stylesheet" href="styles.css">`必ず追加してください
**注:** スタイルシートをリンクして CSS を適用するため、HTML のコード内に必ず `<link rel="stylesheet" href="styles.css">` を追加してください
# --hints--

View File

@@ -24,7 +24,7 @@ dashedName: build-a-tribute-page
上記のユーザーストーリーを満たし、以下のすべてのテストが通るようにして、このプロジェクトを完成させてください。 あなた独自のスタイルを加えましょう。 ハッピーコーディング!
**注:** スタイルシートをリンクして CSS 適用されるように、`<link rel="stylesheet" href="styles.css">` HTML 内に必ず加えてください
**注:** スタイルシートをリンクして CSS 適用するため、HTML のコード内に必ず `<link rel="stylesheet" href="styles.css">`追加してください
# --hints--

View File

@@ -36,7 +36,7 @@ const _callback = element => element.toUpperCase();
assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_callback)));
```
`[1, 1, 2, 5, 2].myMap((element, index, array) => array[index + 1] || array[0])` should return `[1, 2, 5, 2, 1]`.
`[1, 1, 2, 5, 2].myMap((element, index, array) => array[index + 1] || array[0])` deve retornar `[1, 2, 5, 2, 1]`.
```js
const _test_s = [1, 1, 2, 5, 2];