Last active
October 5, 2022 14:22
-
-
Save Taremeh/4270aad7b09b03b1f69469b5c61f56fc to your computer and use it in GitHub Desktop.
Mutual Recursion Example
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
# Sources: | |
# http://www.idc-online.com/technical_references/pdfs/information_technology/Mutual_Recursion_in_Python.pdf | |
# https://library.oapen.org/handle/20.500.12657/26092 | |
def is_even(n): | |
if n == 0: | |
return True | |
else: | |
return is_odd(n-1) | |
def is_odd(n): | |
if n == 0: | |
return False | |
else: | |
return is_even(n-1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment