Create a function to test if a string is a valid pin or not.
A valid pin has:
- Exactly
4
or6
characters. - Only numerical characters (
0-9
). - No whitespace.
valid("1234") ➞ True
valid("45135") ➞ False
valid("89abc1") ➞ False
valid("900876") ➞ True
valid(" 4983") ➞ False
- Empty strings should return
False
when tested.