I am putting this in,
def check(digit):
if digit % 2 == 0:
print("Even number")
check()
and in return i am getting an error which says,
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
check()
TypeError: check() missing 1 required positional argument: 'digit'
Can anyone help me figure what am i doing wrong?
You are not calling your function check with any arguments. You also have to indent your if statement.
def check(digit):
if digit % 2 == 0:
print("Even number")
else:
print("Odd number")
check(3) # Prints "Odd number"
check(4) # Prints "Even number"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With