Deja vu, medium difficulty question (help! why does it not work!) | Sololearn: Learn to code for FREE!

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

9/3/2020 8:09:07 PM

Eric Wang

3 Answers

New Answer

+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 🙏🙏🙏