Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. # a = [1, 2, 1, 3, 4, 5, 6, 2]
  2. #a = [5, 4, 3, 2, 1, 6, 7, 7, 8, 9, 9, 10, 11, 11]
  3.  
  4. a = []
  5. flag = True
  6. while True:
  7. new_element = int(input())
  8. if new_element == 0:
  9. break
  10. a.append(new_element)
  11.  
  12. max = 1
  13. count = 1
  14.  
  15. for index in range(len(a) - 1):
  16. if a[index + 1] > a[index]:
  17. count += 1
  18. if (index + 1) == len(a) - 1:
  19. max = count
  20. else:
  21. if count > max:
  22. max = count
  23. count = 1
  24.  
  25. count = 1
  26.  
  27. for index in range(len(a) - 1):
  28. if a[index + 1] < a[index]:
  29. count += 1
  30. if (index + 1) == len(a) - 1:
  31. max = count
  32. else:
  33. if max < count:
  34. max = count
  35. count = 1
  36.  
  37. print(max)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement