Задача найти, cколько элементов массива больше своих соседей.(python)
a = list(map(int, input().split()))
s=0
if len(a)<3:
print('0')
else:
for i in range(2,len(a)):
if a[i-2]>a[i-1] and a[i]>a[i-1]:
s+=1
print(s)
Вот мой код. Почему не проходит?
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2024 SCHOLAR.TIPS - All rights reserved.