Skip to content

Instantly share code, notes, and snippets.

@AbbadonAA
Last active September 25, 2021 15:39
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 AbbadonAA/a6a9c8f2a068efc492e9c05a79203b1f to your computer and use it in GitHub Desktop.
Save AbbadonAA/a6a9c8f2a068efc492e9c05a79203b1f to your computer and use it in GitHub Desktop.
Form a list of number's divisors
def divisors(integer):
divs = []
if integer > 1:
[divs.append(i) for i in range(2, integer) if integer % i == 0]
if not divs:
return f'{integer} is prime'
else:
return divs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment