a=[1,5,9,2,6,8,3,4,7] n=0 ;flag=True
for i in range(len(a)-1):
if a[i]<a[i+1] and flag==True:
n+=1;flag=False
elif a[i]>a[i+1] and flag==False:
n-=1;flag=True
print(n)
执行上述程序段后, 输出的值为:( )