-2

I expected my method call print(isFour(16)) returns "True", but it actually returned "None". What's wrong?

def isFour(int):
    if int == 4: return True
    if int > 0:
       isPositive(int/2)
        
print(isFour(16)) # expected output is True, but got None
hello1949
  • 1
  • 3

1 Answers1

0

It return None since int is not 4.

If you want it to return true if int is in the 4 times table you should write:

if int % 4 == 0: return True
andr4229
  • 36
  • 1
  • 3