I am beginner trying to write a code that counts how many streaks of 5 is there in a given list. It gives me a syntax error for some reason. Can you please tell me why?
streak=[]
l=['a','b','d','b','h','r','d','j','a','a','a','a','a','b','b','n','n','n','n','n']
for n in range(len(l)-5):
if l[n]==l[n+1]
and ln[n+1]==l[n+2]
and ln[n+2]==l[n+3]
and ln[n+3]==l[n+4]:
streak+=1
print(streak)
File "c:\users\lenovo\mu_code\first program.py", line 4
if l[n]==l[n+1]
^
SyntaxError: invalid syntax
>>>