Identifying an event from a big Python list efficiently
I have a Python list containing integers. The definition of my event: Look at each element of the list and check if that element is greater than a specified number, say S. If before that element, there is a zero, then the Event is recorded. That zero may not be immediately before, however after occurrence of similar past event. I have this list for S = 6: List = [3, 5, 6, 0, 2, 5, 6, 8, 3, 0, 7] There are 2 such events at indices 7 and 10. What is an efficient method to achieve this? A for loop for a large list may not be efficient.
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.