Skip to content

Instantly share code, notes, and snippets.

@carljavier
Last active February 9, 2021 01:30
Show Gist options
  • Save carljavier/9e267e4767ee29774260fdfe567b986f to your computer and use it in GitHub Desktop.
Save carljavier/9e267e4767ee29774260fdfe567b986f to your computer and use it in GitHub Desktop.
Programming/Scriptin - Using your preferred programming or scripting language, write a function that takes a number as an argument and returns the string “aunty” if that number is divisible by 3 and returns “uncle” otherwise.
import sys
# Assumes what is passed into function is integer, however prefer to type cast it to be sure.
def whoisit(index):
# Given that there are two scenarios where value could not be divisible by x could be 0 or any other number.
if (int(index) % 3 > 0) or (int(index) == 0) :
return "uncle"
else :
return "aunty"
print(whoisit(sys.argv[1]))
@carljavier
Copy link
Author

Test via CLI

python whoisit.py 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment