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 Wang3 Answers
New AnswerRemove [] around input() letters = input() You can break loop on first x increment just.
Eric Wang Try: for x in letters itself, if letters.count(x) > 1, print deja Vu, break, else, print Unique, break.
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 🙏🙏🙏
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message