Created
July 18, 2017 12:15
-
-
Save Nickikku/97343ae1c23948925d83ba7b0aa4089b 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
#lucky number is 13 in this case. It means that when input == 13, it will stop the sum of a + b + c. | |
def lucky_sum(a, b, c): | |
if a == 13: #if a == 13 it returns 0 | |
return 0 | |
elif b == 13: #if b == 13 it returns only a | |
return a | |
elif c == 13: #if c == 13 it returns the sum of a + b | |
return a + b | |
else: #if none of them are 13, the sum of a + b + c is calculated | |
return a + b + c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment