Created
April 29, 2015 13:26
-
-
Save sincerefly/324e01601607516f327c 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
#吸血鬼数: http://zh.wikipedia.org/wiki/%E5%90%B8%E8%A1%80%E9%AC%BC%E6%95%B8 | |
def vampire_test(x, y): | |
print sorted(str(x) + str(y)) | |
return sorted(str(x * y)) == sorted(str(x) + str(y)) | |
print vampire_test(21, 6) | |
# result: True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment