-
-
Save stephengruppetta/c550a8600d4e40c84476e6a5c7a2b2a3 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
import random | |
numbers = [random.randint(1, 50) for _ in range(20)] | |
# 'max()' with a different rule. | |
# Can you figure out the rule? | |
print( | |
max( | |
numbers, | |
key=lambda x: sum(int(y) for y in str(x)), | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment