
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Check if a string is Isogram or not in Python
Suppose we have a string s. We have to check whether the given string is isogram or not. The isogram is a string where the occurrence of each letter is exactly one.
So, if the input is like s = "education", then the output will be True because all characters in "education" occurs exactly once.
To solve this, we will follow these steps −
- char_list := a new list
- for each char in word, do
- if char is non numeric, then
- if char is in char_list, then
- return False
- insert char at the end of char_list
- if char is in char_list, then
- if char is non numeric, then
- return True
Let us see the following implementation to get better understanding −
Example
def solve(word): char_list = [] for char in word: if char.isalpha(): if char in char_list: return False char_list.append(char) return True s = "education" print(solve(s))
Input
"education"
Output
True
- Related Articles
- Python - Check if a given string is binary string or not
- Python program to check if a string is palindrome or not
- Check if any anagram of a string is palindrome or not in Python
- Python program to check if a given string is Keyword or not
- Python program to check if the string is empty or not
- Program to check a string is palindrome or not in Python
- Check whether a string is valid JSON or not in Python
- Check if a string follows a^n b^n pattern or not in Python
- Java Program to check if a string is empty or not
- C# program to check if a string is palindrome or not
- Check if list is sorted or not in Python
- Check if a number is Primorial Prime or not in Python
- Program to check the string is repeating string or not in Python
- C# program to check if string is panagram or not
- Swift program to check if string is pangram or not

Advertisements