Luhn checksum validation
Your task
Implement the Luhn checksum used to validate credit-card numbers. Given a card number as a string (which may contain spaces or dashes as separators), return True if it passes the Luhn check. The algorithm: from the rightmost digit moving left, double every second digit; if a doubled value exceeds 9 subtract 9; sum all resulting digits; the number is valid if the total is divisible by 10. Ignore non-digit separators. An input with no digits is invalid.
Examples
luhn_valid(number: str) -> boolExample 1
Input
luhn_valid("4539148803436467")Output
True