Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
360 B
1
Indexable
Never
l1=[7,6,5,8,10,12,11,17]

def peak_finder(l1):
    for i in range(len(l1)):
        if i==0:
            if l1[i]>=l1[i+1]:
                return(l1[i])
        elif i==len(l1):
            if l1[i]>=l1[i-1]:
                return(l1[i])
        elif l1[i]>=l1[i+1] and l1[i]>=l1[i-1]:
            return(l1[i])
        

print(peak_finder(l1))