I have this python-code:
event_list = []
precipitation_avg_list = [1,2,3,4,5,5,6,7,89,97]
for i in range(len(precipitation_avg_list)): current_precip_value = precipitation_avg_list[i]
if i < len(precipitation_avg_list)-3: # as long as iterator i hasnt reached the end of the list
next_precip_value = precipitation_avg_list[i+1]
next_next_precip_value = precipitation_avg_list[i+2]
next_next_next_precip_value = precipitation_avg_list[i+3]
if current_precip_value>0:
event_list.append(1)
elif (current_precip_value>0 and next_precip_value=0 and next_next_precip_value>0):
event_list.append(1)
elif ((current_precip_value>0) and (next_precip_value=0) and (next_next_precip_value=0) and (next_next_next_precip_value>0)):
event_list.append(1)
else:
event_list.append(0)
else:
continue
I get the error: 'SyntaxError: invalid syntax. But I dont see what I did wrong in both variants of the elif-blocks.
Do you see it?
Aucun commentaire:
Enregistrer un commentaire