Skip to content

Instantly share code, notes, and snippets.

@TheRealMentor
Created June 28, 2019 16:19
Show Gist options
  • Save TheRealMentor/724f1f883e31187a3ed52cca97a9f360 to your computer and use it in GitHub Desktop.
Save TheRealMentor/724f1f883e31187a3ed52cca97a9f360 to your computer and use it in GitHub Desktop.
'''
@author: TheRealMentor
@date: 28/06/2019
'''
import math
def allFactors(A):
res = []
if A == 0 or A == 1:
res.append(A)
return res
for i in range(1, int(math.sqrt(A)) + 1):
if A % i == 0:
res.append(i)
res.append(int(A/i))
res = list(set(res))
res.sort()
return res
print(allFactors(36))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment