unable to do increasing decreasing sequencee ques.kindly plz assist
Increasing decreasing sequence in python
Please follow the below solution in python…let me know if its not clear
flag=True
result=True
n=int(input())
prev=int(input())
for i in range(1,n):
curr=int(input())
if(curr==prev):
result=False
break
elif(curr>prev):
flag=False
elif(not (flag) and curr<prev):
result=False
break
prev=curr
if(result==False):
print("false")
else:
print("true")