Created
August 9, 2020 04:02
-
-
Save ks--ks/72e80c43f4fadae79409f1ce3cf0ad12 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
'''Given an int n, return the absolute difference between n and 21, | |
except return double the absolute difference if n is over 21.''' | |
def diff21(n): | |
if n <= 21: | |
return 21-n | |
else: | |
return (n - 21) * 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment