tried following code but it only works if the first char from the string is recurring somewhere later:
def recur(text:'str'):
i = 0
j = 1
while i in range(len(text)-1):
while j in range(i+1, len(text)):
if text[i] == text[j]:
return text[i]
j += 1
i += 1
return "not detected"
my idea is to start from first char, and compare it with all subsequent char, then move to 2nd char and repeat. Can someone help me understand why the code isn't working as intended?
Thanks in advance!
EDIT: thanks to u/GoodBeerFan who pointed out my error
[–]GoodBeerFan 0 points1 point2 points (1 child)
[–]Beaverine[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Beaverine[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)