From 89f5ee1ca649a077560fa9005013967bf4ec4b86 Mon Sep 17 00:00:00 2001 From: Egor Kostan Date: Tue, 9 Sep 2025 18:56:53 -0700 Subject: [PATCH] Update isbn_verifier.py --- isbn-verifier/isbn_verifier.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/isbn-verifier/isbn_verifier.py b/isbn-verifier/isbn_verifier.py index 80e1a8a..ed23d00 100644 --- a/isbn-verifier/isbn_verifier.py +++ b/isbn-verifier/isbn_verifier.py @@ -33,10 +33,8 @@ def formatted_isbn(isbn: str) -> list[int]: for char in isbn: if char.isdigit(): result.append(int(char)) - if isbn[-1].lower() == "x": + if isbn[-1] == "X": result.append(10) - - print(f"result: {result}, len: {len(result)}") return result @@ -48,6 +46,7 @@ def is_valid(isbn: str) -> bool: :return: Tru if isbn is valid, False otherwise """ # Non ISBN chars or empty strings not allowed + isbn = isbn.upper() if not all(char in ISBN for char in isbn.replace("-", "")) or not isbn: return False # In case X is present, it should be at the end of the string only