

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 Questions & Answers
- Python - Check if a given string is binary string or not
- Python program to check if a string is palindrome or not
- Python program to check if a given string is Keyword or not
- Check if any anagram of a string is palindrome or not in Python
- Python program to check if the string is empty or not
- C# program to check if a string is palindrome or not
- Java Program to check if a string is empty or not
- Check if list is sorted or not in Python
- C# program to check if string is panagram or not
- Check if a number is Primorial Prime or not in Python
- C program to check if a given string is Keyword or not?
- Check whether a string is valid JSON or not in Python
- Program to check a string is palindrome or not in Python
- Python program to check if a number is Prime or not
- Check if a number is an Achilles number or not in Python
Advertisements