Question: If there's a window list

```
text='abcdefg'
window_list=[text[i:i+3] for i in range(len(text)-3)]
print window_list
['abc', 'bcd', 'cde', 'def']

for i in window_list:
    for j,k in zip(range(len(text)),i):
    print j,k
0 a
1 b
2 c
0 b
1 c
2 d
0 c
1 d
2 e
0 d
1 e
2 f

```

i'm trying to make it so when 

```
(j==0 and k=='c') and (j==1 and k=='d') and (j==2 and k=='e')

```

it would give me the starts and ending position where that occurs on the string text

so it would give me

```
[2-4]

```

Answer: 
```
import re
seq = 'abcdefabcdefabcdefg'
for match in re.finditer('abc', seq):
    print match.start(), match.end()

```
**Logic:**

All you need to do is find if your pattern is in the doc or not. This can be done easily using Python in built string "find" function. Once you find the start position of your string, then all you need to do is add the length of your pattern to get end position. thats it! job done ;)

**The Code:**

```
text = "abcdefghifjklmnopqrstuvwxyz"
start_position = text.find("abc")
if(start_position>-1):
    end_position = start_position+len(start_position) - 1
else:
    print "Pattern not found"
print start_position, "-", end_position

```

**The Output:**

```
0 - 2

```

**Reference:**
Check Official Python String Functions Documentation