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