Increasing decreasing sequence in python

unable to do increasing decreasing sequencee ques.kindly plz assist

Please follow the below solution in python…let me know if its not clear :blush:

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")