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')
3 Réponses
+ 1
Remove [] around input()
letters = input()
You can break loop on first x increment just.
+ 3
Eric Wang
Try:
for x in letters itself, if letters.count(x) > 1, print deja Vu, break, else, print Unique, break.
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 🙏🙏🙏