0

Deja vu, medium difficulty question (help! why does it not work!)

letters = [input()] x = 0 for i in range(len(letters)): if 2 <= letters.count(letters[i]): x = x + 1 elif 2 > letters.count(letters[i]): x += 0 if x == 0: print('Unique') elif x > 0: print('Deja Vu')

3rd Sep 2020, 8:09 PM
Eric Wang
Eric Wang - avatar
3 Answers
+ 1
Remove [] around input() letters = input() You can break loop on first x increment just.
3rd Sep 2020, 8:30 PM
Jayakrishna 🇼🇳
+ 3
Eric Wang Try: for x in letters itself, if letters.count(x) > 1, print deja Vu, break, else, print Unique, break.
3rd Sep 2020, 8:24 PM
Tomiwa Joseph
Tomiwa Joseph - avatar
0
Jayakrishna🇼🇳 Tomiwa Joseph thank you guys! it worked! I used Jayakrishna’s way cause it is closer to my original code, but i also tried Tomiwa’s way and it is also pretty similar. Thanks again guys 🙏🙏🙏
4th Sep 2020, 12:18 AM
Eric Wang
Eric Wang - avatar