apologies to posting the question, as has been answered in other questions as well. However, couldn't figure out what's wrong with this solution. The question requires to find the lower-cased characters bordered by 3 upper-cased characters on each side. The code i've writting:
q = ''
for i in range(4,len(x)-4):
if x[i].islower() and x[i-4].islower() and x[i+4].islower() and x[i-3:i].isupper() and x[i+1:i+4].isupper() :
q+=x[i]
print(q)
The string i'm getting is
'lgvcaaginbkvsoezhtlnldslyitlooqfgiksudtm' vs 'linkedlist'
Thanks for the help.
Edit: for some reason the following code seems to work:
q = ''
for i in range(4,len(x)-4):
if x[i].islower() and x[i-4].islower() and x[i-3:i].isupper() and x[i+1:i+4].isupper() and x[i+4].islower():
q+=x[i]
print(q)