The printing output I'm getting contains the list that I want, but also the word None
for some reason. I have a function defined as factors
and my main function that is trying to print the factors of a specified number. Like I said, my output is:
[1, 17]
None
This is what my current code looks like and everything is indented, but stack overflow wont let me copy it over cleanly:
def factors(myNumber):
fact = []
for i in range(1, myNumber + 1):
if myNumber % i == 0:
fact.append(i)
print(fact)
def main():
print(factors(17))
if __name__ == "__main__":
main()