Skip to content
Code ReadingFirst Negative
Break the Code

First Negative

Write a list for which this function gives the wrong answer.
1def first_negative(values):
2 for i in range(1, len(values)):
3 if values[i] < 0:
4 return i
5 return -1