Why is "print()" required for my function to give a result in Python?
I noticed that if I remove the print() around my function call, it doesn't give me any result. Why is that? This function is from a simple assignment in Python which is to find the factor pairs of a number. I did that quite easily but now, when I use print(getFactorPairs(...)), the result is as expected, but when I just call the function getFactorPairs(...), it doesn't give me any result. # Find the factor pairs of a given number def getFactorPairs(n=0): num = n factors = [] pair = None for p in range(1, num + 1): for r in range(1, num + 1): if p * r == num: pair = (p, r) if (r, p) not in fact
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.