len 31

Regex validate PIN code

Description: ATM machines allow 4 or 6 digit PIN codes and PIN codes cannot contain anything but exactly 4 digits or exactly 6 digits. If the function is passed a valid PIN string, return true, else return false. Examples (Input --> Output) Solution: 1. 인자가 숫자인지 확인한다. 2. 인자의 길이가 4 혹은 6이라면 pin을 반환한다. def validate_pin(pin): return pin.isdigit() and len(pin) in (4, 6)