>>> c = {str(i):i+random.randrange(10) for i in range(10)}
>>> c
{'0': 6, '1': 6, '2': 7, '3': 3, '4': 11, '5': 5, '6': 13, '7': 14, '8': 14, '9': 17}
>>> [l for l,r in sorted(c.items(), key=lambda x:x[1], reverse=True)][:16-len(c)]
['9', '7', '8', '6', '4', '2']
Last active
November 6, 2019 03:08
-
-
Save Asuforce/8d49a66240288350f6e5ae31966a950d to your computer and use it in GitHub Desktop.
内包記法の練習
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment