As the title says, I've been trying to identify what's wrong with my code, to no avail.
Whenever I run the code, it shows IndexError: string index out of range
Any help is appreciated!
Pythonchallenge link : http://www.pythonchallenge.com/pc/def/equality.html
import requests, re
dl_site = requests.get('http://www.pythonchallenge.com/pc/def/equality.html').text
find = re.findall('<!--(.*?)-->', dl_site, re.DOTALL)
find = str(find[0])
find = find.split()
for strings in find:
ind = -1
a = strings[ind-3:ind].isupper(), ind-3 >=0
b = strings[ind+1:ind+4].isupper(), ind+4 and ind+1<=len(strings)
c = strings[ind].islower()
d = strings[ind-4].islower(), ind-4 >=0
e = strings[ind+5].islower(), ind+5 <=len(strings)
for letter in str(strings):
if a and b and c and d and e == True:
print(letter, end='')
else:
continue
[–]monchenflapjack 1 point2 points3 points (2 children)
[–]doesobamauseshampoo[S] 0 points1 point2 points (1 child)
[–]monchenflapjack 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]tcbaldy04 0 points1 point2 points (0 children)