#145EasyFunctions· Decomposition
ISBN-10 Validator
Input format
`code`: a string.
Output format
`true` or `false`.
Examples
Input: code = "0-306-40615-2"
Output: true
0*10 + 3*9 + 0*8 + 6*7 + 4*6 + 0*5 + 6*4 + 1*3 + 5*2 + 2*1 = 132 = 12 * 11.
Input: code = "0-306-40615-3"
Output: false
Changing the check digit breaks the checksum.
Constraints
- 0 <= len(code) <= 50
Study first
- #python
- #functions
- #validation
- #checksums
