+ 2
Where is my mistake ?(Python) Please help me!
https://sololearn.com/coach/54/?ref=app My code: x=input() z=list(x) for i in range(0,len(z),1): if z.count(z[i])>1: print("Deja Vu") elif z.count(z[i])==1: print("Unique") Ex.)input="aabc",and ı want to print just "Deja Vu" Because in this input, there are more than one "a" letter. If input ="abc", ı want to print "Unique" because all letters in input used once. My code prints "Deja Vu,Deja Vu,Unique,Unique" for input ="aabc".
3 Respuestas
+ 6
Hüseyin Emre Gözen , please give a clear description what your "mistake" means.
How did you make the input? looking at the code it should be like a string with no separators. e.g.: "abca" should output if the examined character is unique or not.
Please also show us an input sample and what you expect as output.
Thanks!
+ 4
According to the question you have to check the entire string for redundancy of characters.
The problem here is that your program will print "Unique" everytime it will encounter a non-redundant character and "deja vu" otherwise.
Input = abbc
Output :-
Unique
Deja Vu
Deja Vu
Unique
expected output :-
Deja vu