Created
January 4, 2020 16:58
-
-
Save kkt-ee/311f079c8d32b230a9197d5684ba87b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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. | |
""" | |
def validate_pin(pin): | |
#return true or false | |
return pin.isdigit() and (len(pin) == 4 or len(pin) == 6) | |
#OR | |
def validate_pin(pin): | |
return len(pin) in (4, 6) and pin.isdigit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment