Created
July 4, 2021 20:08
-
-
Save brentxphillips/a73f736e8037a3c85d8e780f82a5d9ee to your computer and use it in GitHub Desktop.
Simple value returning function with odd or even test
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
# 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