Skip to content

Instantly share code, notes, and snippets.

@Nickikku
Created July 18, 2017 12:42
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/947543aec823d3e8d81e69a15de1c43d to your computer and use it in GitHub Desktop.
Save Nickikku/947543aec823d3e8d81e69a15de1c43d to your computer and use it in GitHub Desktop.
#adds only if values are no teens, exept for 15 & 16.
def no_teen_sum(a, b, c):
if ((a > 10 and a < 15) or (a > 16 and a < 20)) and ((b > 10 and b < 15) or (b > 16 and b < 20)) and ((c > 10 and c < 15) or (c > 16 and c < 20)):
return 0
if (a > 10 and a < 15) or (a > 16 and a < 20):
if (b > 10 and b < 15) or (b > 16 and b < 20):
return c
elif (c > 10 and c < 15) or (c > 16 and c < 20):
return b
else:
return b + c
if (b > 10 and b < 15) or (b > 16 and b < 20):
if (a > 10 and a < 15) or (a > 16 and a < 20):
return c
elif (c > 10 and c < 15) or (c > 16 and c < 20):
return a
else:
return a + c
if (c > 10 and c < 15) or (c > 16 and c < 20):
if (b > 10 and b < 15) or (b > 16 and b < 20):
return a
elif (a > 10 and a < 15) or (a > 16 and a < 20):
return b
else:
return b + a
else:
return a + b + c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment