Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. def how_many_neighbors(x):
  2.     amount = 0
  3.     for index in range(len(x) - 2):
  4.         if x[index] < x[index + 1] > x[index + 2]:
  5.             amount += 1
  6.     return amount
  7.  
  8.  
  9. number_list = list(map(int, input().split()))
  10. print(how_many_neighbors(number_list))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement