Skip to content

Instantly share code, notes, and snippets.

@dawranliou
Created April 26, 2018 01:36
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 dawranliou/306e98b317446a5aa1197f1e86003f5e to your computer and use it in GitHub Desktop.
Save dawranliou/306e98b317446a5aa1197f1e86003f5e to your computer and use it in GitHub Desktop.
def is_tri(n):
for tri in tri_gen():
if tri > n:
return False
elif tri == n:
return True
else:
continue
is_tri(10)
# True
is_tri(11)
# False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment