+ 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.
3 odpowiedzi
+ 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)):
...
+ 1
word = input()
word1 = set(word)
word2 = sorted(word)
if len(word1) == len(word2):
print("true")
else:
print("false")
0
Lothar oh i Will Be Carefull next time...
And thanks The Hints