-
-
Save hntrmrrs/595089 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
# a heavy int is one where the average of the digits is greater than 7 | |
# eg: 8678 is heavy because (8 + 6 + 7 + 8) / 4 = 7.25 | |
# 8677 is not heavy because ( 8 + 6 + 7 + 7) / 4 = 7 | |
def is_heavy(my_number, heaviness=7): | |
# map each digit to a float and divide by the length | |
digits = str(my_number) | |
return sum(map(float, digits)) / len(digits) > heaviness |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment