Fix Incorrect Comment in String Indexing Example
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 58/100
- Tipo de issue
- Documentación
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- documentation
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Python
- Estrellas
- 18.3k
- Forks
- 3k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de trekhleb/learn-python
-
Typo in Variable Name: "weapon.strip()" Should Be "fruit.strip()" in List Comprehensions Example Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
trekhleb/learn-python#105 · 1 comentario ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
trekhleb/learn-python#104 · 1 comentario ·
-
Learning Python Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 10/100
trekhleb/learn-python#108 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 30/100
trekhleb/learn-python#107 · 1 comentario ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
trekhleb/learn-python#106 ·
Todos los issues de trekhleb/learn-python
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
xinnan-tech/xiaozhi-fde-talk#263 ·
-
rules
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
huggingface/Repo2RLEnv#163 · 1 comentario ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
huggingface/sentence-transformers#4074 ·
-
comp/dashboard invalid P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
NousResearch/hermes-agent#121143 ·