- 1
What am I doing wrong?
My code for code coach( Deja vu ) isn't passing all the test runs. My code: word = list(input()) def func(x): for i in x: a = "Unique" b = "Deja vu" if x.count(i) > 1: return b else: if x.count(i) == 1: return a print(func(word))
2 Antworten
+ 3
return stops the execution of function . So, for loop only runs once. Here i corrected it a bit ,
word = list(input())
def func(x):
a = "Unique"
b = "Deja vu"
for i in x:
if x.count(i) > 1:
return b
return a
print(func(word))
Also keep those a and b variables outside of for loop, otherwise you are just defining them again and again
0
Abhay
Thank you