Created
May 17, 2025 14:11
-
-
Save AdryDev92/ba7137c8bae74cf4b2ac14c46ea74c5b to your computer and use it in GitHub Desktop.
A function to check if a word has repeated characters and tell you if it's an isogram or not
This file contains hidden or 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
| word = input("Please write a word: ") | |
| word = word.lower() | |
| def isIsogram(word): | |
| array = [] | |
| for character in word: | |
| if character not in array: | |
| array.append(character) | |
| else: | |
| print("Is not an isogram") | |
| return False | |
| print("Is an isogram") | |
| return True | |
| #This function checks each character in the word | |
| # and adds it to an array if it is not already present. | |
| # If a character is found in the array, it means | |
| # it is a duplicate, and the function returns False. | |
| # If all characters are unique, it returns True. | |
| isIsogram(word) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment