1

I tried to make a program to determine whether a number is odd or not, I get the following output

def is_odd(n):
    if n % 2 != 0:
       print(True)
    else:
       print(False)

if I put

print(is_odd(1))

I get:

True
None

Whatever number I choose, I always get

None

at the end.

Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153
Sam Vanbergen
  • 145
  • 3
  • 11

1 Answers1

3

You have to return something to remove this None . You can also modify the code by returning the True or false and print it in the main