Skip to content

Instantly share code, notes, and snippets.

@Nickikku
Created July 18, 2017 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nickikku/97343ae1c23948925d83ba7b0aa4089b to your computer and use it in GitHub Desktop.
Save Nickikku/97343ae1c23948925d83ba7b0aa4089b to your computer and use it in GitHub Desktop.
#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