Skip to content

Instantly share code, notes, and snippets.

@brentxphillips
Created July 4, 2021 20:08
Show Gist options
  • Save brentxphillips/a73f736e8037a3c85d8e780f82a5d9ee to your computer and use it in GitHub Desktop.
Save brentxphillips/a73f736e8037a3c85d8e780f82a5d9ee to your computer and use it in GitHub Desktop.
Simple value returning function with odd or even test
# Simple value returning function, plus odd or even test
# return_test2.py
def pass_info(x, y):
sum = x + y
# nested conditional testing if a new math operation changes the sum returned?
# tests if sum is even
if (sum % 2 == 0):
sum += 1
# tests if sum is odd
elif (sum % 2 == 1):
sum -= 1
return sum
def main():
output = pass_info(5, 4)
print(output)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment