Skip to content

Instantly share code, notes, and snippets.

@aheze
Last active June 5, 2020 19:21
Show Gist options
  • Select an option

  • Save aheze/036d19aa56a375b8b03cee7f05508b3c to your computer and use it in GitHub Desktop.

Select an option

Save aheze/036d19aa56a375b8b03cee7f05508b3c to your computer and use it in GitHub Desktop.
# define the function
def match_number(number, singular, plural):
if number == 1:
return str(number) + " " + singular # return the number + the singular noun
else:
return str(number) + " " + plural # return the number + the plural noun
followers_count = 1
grammarized_followers = match_number(number = followers_count, singular = "follower", plural = "followers")
print(grammarized_followers) # 1 follower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment