Skip to content

Instantly share code, notes, and snippets.

@MuddyBootsCode
Last active May 15, 2016 00: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 MuddyBootsCode/fdf95e4f6bcf696422adda41eda0567c to your computer and use it in GitHub Desktop.
Save MuddyBootsCode/fdf95e4f6bcf696422adda41eda0567c to your computer and use it in GitHub Desktop.
divisors = []
userNumber = int(input('Please give me a number and I\'ll give you all of that numbers divisors.\n'))
userRange = range(userNumber + 1)
for i in range(len(userRange)):
try:
if userNumber % userRange[i] == 0:
divisors.append(userRange[i])
except ZeroDivisionError:
pass
print (divisors)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment