+ 1

Any Other Solution?

Write a program that takes in a string as input, detects if the string is an isogram and outputs true or false based on the result. Input Format: A string containing one word. Output Format: A string: true or false.

21st Dec 2024, 2:18 PM
HASAN IMTIAZ
HASAN IMTIAZ - avatar
3 Respuestas
+ 3
HASAN IMTIAZ , this is not the right place to ask for improvements, since your code is running properly and creates correct outputs. place this kind of `questions` in the feed of the community section. hints: > we do not need to sort the input string, just use it as it is > the 2nd and 3rd code line can be avoided when using this as the conditional: ... if len(word) == len(set(word)): ...
21st Dec 2024, 4:22 PM
Lothar
Lothar - avatar
+ 1
word = input() word1 = set(word) word2 = sorted(word) if len(word1) == len(word2): print("true") else: print("false")
21st Dec 2024, 2:18 PM
HASAN IMTIAZ
HASAN IMTIAZ - avatar
0
Lothar oh i Will Be Carefull next time... And thanks The Hints
22nd Dec 2024, 1:24 AM
HASAN IMTIAZ
HASAN IMTIAZ - avatar