geostocker geostocker - 22 days ago 7
Python Question

Strange test-case result in CodeWars Kata

I need some help solving a CodeWars Kata that I'm kind of stuck with. For some reason I am receiving a False in one of the test-cases and I can't find the real reason behind it.

The instructions are to validate a

string(ping)
. The requirements are that the string needs to have the length of 4 or 6 and can only consist of digits.

This is my code:

def validate_pin(pin):

if (len(pin) != 4 or len(pin) != 6):
return False
print(pin.isdigit())
if(pin.isdigit()):
return True
else:
return False


It passes 9/10 tests. This is the input / output for the failed test:


I recieve False on validate_pin('1234'):


Wrong output for '1234': False should equal True


Answer
if (len(pin) != 4 and len(pin) != 6):