Fix Incorrect Comment in String Indexing Example
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 58/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- documentation
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 18.3k
- Fork
- 3k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của trekhleb/learn-python
-
Typo in Variable Name: "weapon.strip()" Should Be "fruit.strip()" in List Comprehensions Example Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
trekhleb/learn-python#105 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
trekhleb/learn-python#104 · 1 bình luận ·
-
Learning Python Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
trekhleb/learn-python#108 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
trekhleb/learn-python#107 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
trekhleb/learn-python#106 ·
Tất cả issue của trekhleb/learn-python
Issue tương tự
-
[Bug] reef-hermes tells me to resume with hermes --resume, which does not work from my shell Đang mởarea: harness bug status: needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Human-Agent-Society/reef#625 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
learningequality/kolibri#15351 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Name consistency Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
eellak/triplestore#65 · 1 bình luận ·