0
Isogram detector
Hi, The code for an isogram detector (each letter only once) passes 3 out of 5 test cases. Something seems to be wrong with my code. Maybe something about the count function? https://code.sololearn.com/cfnkVQDYfZcu/?ref=app
6 Answers
0
input = input()
count = 0
for i in input:
count += input.count(i)
if count > len(input):
print("false")
else:
print("true")
+ 3
Your program just check the input word last letter is isogram Or not.
for x in word :
#this iterate through all letter in word. If any word count is greater than 1 then break loop. And print false..
If all letter count is 1 only, then print true..
Hope it helps..
+ 2
Why are you checking for the presence of a character in a word if the loop has already selected it from this word đł
JaScript why are you checking a boolean variable if just printing its value is enough đ
+ 1
What a tight solution! Perfect, thanks!
- 1
Solo yes, very good. I slept here. But in any way you have to print the result in lower letters. So at least you hve to convert the output value.
- 2
# The problem is that you overwritte your count variable
# In this way not
word = input()
iso = True
for x in word:
if x in word:
count = word.count(x)
if count > 1:
iso = False
break
if iso:
print("true")
else:
print("false")