Created
June 17, 2021 08:25
-
-
Save saswata-dutta/7d64d720b46b752d99f98b166ccc9cdd to your computer and use it in GitHub Desktop.
operate on two list at once
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def process(kstr, vstr, n): | |
k = filter(lambda x: x != "id", kstr.split()) | |
v = vstr.split() | |
kv = list(zip(k, v)) | |
exe = filter(lambda x: x[0] == "execution", kv) | |
tot = filter(lambda x: x[0] == "total", kv) | |
times = ((float(t[1]), float(e[1])) for e,t in zip(exe, tot)) | |
best_times = sorted(times)[:n] | |
return best_times |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment