Feb-27-2019, 12:24 PM
for index, ch in enumerate('si si si no yes si'): print(f'{index} --> {ch}') print('si si si no yes si'.find('i', 8, 10))
Output:0 --> s
1 --> i
2 -->
3 --> s
4 --> i
5 -->
6 --> s
7 --> i
8 -->
9 --> n
10 --> o
11 -->
12 --> y
13 --> e
14 --> s
15 -->
16 --> s
17 --> i
-1
>>>
as you can see, 'i' is on index 1, 4, 7 and 17. with start=6 and end=10 you catch the 'i' on index 7
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs