fork download
  1. def check(n):
  2. if n>0:
  3. return(1)
  4. else:
  5. return(-1)
  6.  
  7. fdi=[-4,1,-5,-4,-3,-2,1,2,3,4,-10,-11] ; n=12
  8. inf=[0]
  9. for i in range(n-1):
  10. if check(fdi[i]) == check(fdi[i+1]):
  11. inf.append(0)
  12. else:
  13. inf.append(1)
  14.  
  15. print(inf)
Success #stdin #stdout 0.02s 28384KB
stdin
Standard input is empty
stdout
[0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0]