+ 1
Isogram detector (Python with regex)
I have tried to solve this problem with reg. expressions but when there is any repetition give false when it should come true. Can anyone help me? import re x=input() y=r"([a-z])?" if re.search(x,y): print ("true") else: print ("false")
4 Réponses
+ 2
Can you please give example inputs since it is not clear what exactly the problem is?
0
Ok. Objective: detect words without any of the letters repeated. Example: come(0 letters repetead), sololearn(o and l are repeted).
0
Try this:
word=input()
list_word=list(word)
n=0
while n < len(list_word):
if list_word.count(list_word[n]) == 1:
n+=1
else:
break
if n==len(list_word):
print ("true")
else:
print ("false")
0
import re
s=input().lower()
pattern=r'([a-z]).*\1'
if re.search(pattern,s):
print('false')
else:
print('true')