Fix Incorrect Comment in String Indexing Example
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 58/100
- Tipo di issue
- Documentazione
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- documentation
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 18.3k
- Fork
- 3k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di trekhleb/learn-python
-
Typo in Variable Name: "weapon.strip()" Should Be "fruit.strip()" in List Comprehensions Example Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
trekhleb/learn-python#105 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
trekhleb/learn-python#104 · 1 commento ·
-
Learning Python Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
trekhleb/learn-python#108 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
trekhleb/learn-python#107 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
trekhleb/learn-python#106 ·
Tutte le issue di trekhleb/learn-python
Issue simili
-
bug confirmed issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
open-webui/open-webui#30750 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100