Commit db78306
authored
Update 11-lists.md Working With the End exercise
Fix an error in the Working With the End exercise.
If a string has N elements, the most negative index that can be safely used is -N not -(N-1), corresponding to the [0] index.
>>> element = 'helium'
>>> print(element[-1])
m
>>> N = len(element)
>>> print(N)
6
>>> print(element[-(N-1)]) #This will give us the [1] index (e)
e
>>> print(element[-(N)])
h1 parent 858046e commit db78306
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
| 280 | + | |
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| |||
0 commit comments