Fix Incorrect Comment in String Indexing Example
まだ誰も着手していません。
評価
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 初心者へのやさしさ
- 58/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
Open src/data_types/test_strings.py and inspect the string indexing example around the two assertions. Update the inaccurate position comment so it matches the zero-based index, then verify that the example remains valid and the comment identifies the character correctly.
索引モデルが issue の本文から書いたものです。
説明
Hello,
I've noticed a small error in the comments of the string indexing example provided in the [src/data_types/test_strings.py]. The comment incorrectly refers to the sixth character of the string as the "Fifth character".
Current Code:
word = 'Python'
assert word[0] == 'P' # First character.
assert word[5] == 'n' # Fifth character.
Issue:
The comment for assert word[5] == 'n' incorrectly states "Fifth character" while it actually checks the sixth character of the string word.
Suggested Correction:
word = 'Python'
assert word[0] == 'P' # First character.
assert word[5] == 'n' # Sixth character.
Correction Explanation:
Python strings are zero-indexed, so the first character is at index 0, and the sixth character is at index 5. The proposed change corrects the comment to accurately reflect the character's position in the string.
I hope this helps improve the documentation/code for future readers. If it's okay, I can submit a pull request #83 with this minor fix.
Thank you for your attention to this matter.
Best regards,
fancling
- 主要言語
- Python
- スター
- 18.3k
- フォーク
- 3k
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
trekhleb/learn-python のほかの issue
-
Typo in Variable Name: "weapon.strip()" Should Be "fruit.strip()" in List Comprehensions Example オープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
trekhleb/learn-python#105 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
trekhleb/learn-python#104 · コメント 1 件 ·
-
Learning Python オープン
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
trekhleb/learn-python#108 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
trekhleb/learn-python#107 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
trekhleb/learn-python#106 ·
trekhleb/learn-python の issue をすべて見る
似ている issue
-
area: harness bug status: needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Human-Agent-Society/reef#625 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
learningequality/kolibri#15351 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Name consistency オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
eellak/triplestore#65 · コメント 1 件 ·