Created
June 28, 2019 16:19
-
-
Save TheRealMentor/724f1f883e31187a3ed52cca97a9f360 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
@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