easy +10 pts

Is isogram

Check if a word is an isogram—no letter repeats, ignoring case.

An isogram is a word in which no letter occurs more than once (e.g., "background", "subdermatoglyphic"). Write a function `is_isogram(s: str) -> bool` that returns `True` if the input string `s` is an isogram and `False` otherwise. Rules: - Consider only alphabetic characters (A-Z, a-z). - The check is case-insensitive, so 'A' and 'a' are considered the same letter. - Non-letter characters (digits, spaces, hyphens, etc.) are ignored and do not affect the result. - An empty string or a string with no letters is considered an isogram (vacuously true).

Constraints

- `s` is a string of length 0 to 1000. - The function should return a boolean. - Time complexity: O(n), space complexity: O(1) (fixed alphabet) or O(k) where k is the number of distinct letters.

Example

>>> is_isogram('isogram')
True
>>> is_isogram('python')
True
>>> is_isogram('Alphabet')
False
>>> is_isogram('hello')
False
10 points ~10 min

Recent Submissions

No submissions yet — hit Run Tests to try!

Hints

Convert the string to lowercase before processing.
Use a set to track seen letters.
Ignore any character that is not alphabetic (e.g., use `.isalpha()`).
Python 3
All tests passed!
Test Results
Press Ctrl+Enter or click Run Tests to execute your code.