Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python check if array alternating

def alternating(list):
  for i  in range(1,len(list)):
    if (((list[i]>list[i+1]) and (list[i]>list[i-1])) or ((list[i]  <list[i+1]) and (list[i]<list[i-1]))) :
      return True
    else:
      return False
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #check #array #alternating
ADD COMMENT
Topic
Name
3+6 =