[Solved] Function is returning NoneType in Python instead of integer [closed]
To elaborate on comments from Nin17 and molbdnilo: Your function function(n) is supposed to return an integer value. Like you did in if branch with return(n**2), do return in the else branch: def function(n): if n % 4 == 1: return n**2 else: return function(n + 1) # inlined the increased n and do return … Read more