python

def hillvalley(l):

  if len(l)<4:

    return False

  if((l[1]-l[0])>0):

    v=1

  else:

    v=-1

  p=0

  for i in range(len(l)-1):

    if((l[i+1]-l[i])>0):

      d=1

    else:

      d=-1

    if (d!=v):

      p+=1

      v=d

  if(p==1):

    return (True)

  else:

    return(False)

Comments

Popular posts from this blog

⭐ UNIT – 3 (Easy Notes + PDF References) Wireless LAN • MAC Problems • Hidden/Exposed Terminal • Near/Far • Infrastructure vs Ad-hoc • IEEE 802.11 • Mobile IP • Ad-hoc Routing

UNIT–5 (Simplified & Easy Notes) Software Architecture Documentation

ch 2 pm