0

Deja Vu - pass 4 /5. What's wrong with my code?

Couldn't pass final hidden test. Please advice what's wrong with my code? given = input() count = 0 for i in given: if i in given[:count]: print("Deja Vu") elif count==(len(given)-1): print("Unique") break else: count += 1 continue

31st Jan 2021, 3:21 PM
Alexey Shikanov
Alexey Shikanov - avatar
2 ответов
+ 1
Tested your code with "ajdhfshsbs". Prints "Deja Vu" thrice. Add "break" after 'print("Deja Vu")', so that that message will be printed only once. And other "break" and "continue" are not needed, but you can keep them. If you did not understand what I meant, see this code: https://code.sololearn.com/cLu6qAEO3tvb/?ref=app
1st Feb 2021, 8:40 AM
#0009e7 [get]
#0009e7 [get] - avatar
+ 1
You are great! Thank you very much. I see now.
1st Feb 2021, 8:55 AM
Alexey Shikanov
Alexey Shikanov - avatar