- 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))

23rd Jun 2021, 7:02 PM
Francis Omane Asirifi
Francis Omane Asirifi - avatar
2 Answers
+ 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
23rd Jun 2021, 7:14 PM
Abhay
Abhay - avatar
0
Abhay Thank you
23rd Jun 2021, 7:38 PM
Francis Omane Asirifi
Francis Omane Asirifi - avatar