-
-
Save lll9p/148d4b04417edc0c0df2a9eea8ce5cd9 to your computer and use it in GitHub Desktop.
This file contains 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
# https://www.v2ex.com/t/298833 | |
from xx import my_get_s | |
ss = [int(my_get_s()) for i in range(3)] | |
# dict version | |
conds = ({1: 1, 2: 2, 3: 5, 4: 9, 5: 7, 6: 8, }, # x | |
{1: 1, 2: 6, 3: 6, 4: 8, }, # y | |
{1: 8, 2: 5, 3: 2, 4: 7, 5: 3, }, # z | |
) | |
x, y, z = map(lambda d, s: d.get(s, -1), conds, ss) | |
# tuple version | |
conds = ((1, 2, 5, 9, 7, 8), # x | |
(1, 6, 6, 8), # y | |
(8, 5, 2, 7, 3), # z | |
) | |
x, y, z = map(lambda l, s: l[s - 1] if 0 <= s < len(l) else -1, conds, ss) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment