Skip to content

Instantly share code, notes, and snippets.

@Taremeh
Last active October 5, 2022 14:22
Show Gist options
  • Save Taremeh/4270aad7b09b03b1f69469b5c61f56fc to your computer and use it in GitHub Desktop.
Save Taremeh/4270aad7b09b03b1f69469b5c61f56fc to your computer and use it in GitHub Desktop.
Mutual Recursion Example
# 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