mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Improve getting the first valid value.
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
from __future__ import print_function
|
||||
|
||||
def findFirst(data, target):
|
||||
for idx, value in enumerate(data):
|
||||
if value >= target:
|
||||
return idx
|
||||
|
||||
return None
|
||||
return next(idx for idx, value in enumerate(data) if value >= target)
|
||||
|
||||
target = 34000000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user