Skip to content

Instantly share code, notes, and snippets.

@RyanNutt
Created November 20, 2021 20:28
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 RyanNutt/d495123adc39e92423cf4119360fa96c to your computer and use it in GitHub Desktop.
Save RyanNutt/d495123adc39e92423cf4119360fa96c to your computer and use it in GitHub Desktop.
Recursive is_odd. Not something to actually use, but will probably talk about this in class as an example for recursion. https://www.reddit.com/r/ProgrammerHumor/comments/qyb5ut/odd/
def is_odd(num):
if k == 1:
return True
elif k == 0:
return False
elif (num < 0):
return is_odd(num * -1)
else:
return is_odd(num - 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment