+ 1

Deja Vu : code coach peobel

The given code will pass all the test in "Deja Vu" chellenge in coad coach expect the last one . I don't know why . Please help me out . word = input() def attention(data): for i,p in zip(data[0:] , data[1:]): if i is p: print("Deja Vu") break else: if p is data[-1]: print("Unique") attention(word)

12th Aug 2020, 5:31 PM
Saran
Saran - avatar
10 Réponses
+ 3
Try to put this input: Saran It will come unique because your program will check only the consecutive letters It should be Deja Vu See a shorter method to solve the problem: https://code.sololearn.com/c2mMDtrlEnoQ/?ref=app
12th Aug 2020, 6:14 PM
Namit Jain
Namit Jain - avatar
+ 2
here is my solution. slightly different approach x = input("") if len(x) > len(set(list(x))): print("Deja Vu") else: print("Unique")
31st Oct 2020, 12:13 PM
Frederick Shanks
Frederick Shanks - avatar
+ 1
Print out the tupels, then you'll see, you miss a lot... Especially at the end of the strings.
12th Aug 2020, 6:05 PM
Sandra Meyer
Sandra Meyer - avatar
+ 1
Thanks Namit Jain Finally I find the solution word = input() def atentuon(data): string = [] for i in data: if i in string: return "Deja Vu" else: string.append(i) return 'Unique' def main(): print(atentuon(word)) main()
12th Aug 2020, 6:40 PM
Saran
Saran - avatar
+ 1
Namit Jain cuz I'm a new bee 😅 I'll get to learn more ...
12th Aug 2020, 6:45 PM
Saran
Saran - avatar
+ 1
Saran Ohh noo! You are an awesome guy! You tried! And finally solved it! 🙃
12th Aug 2020, 6:46 PM
Namit Jain
Namit Jain - avatar
+ 1
Namit Jain Thanks a lot 😁
12th Aug 2020, 6:48 PM
Saran
Saran - avatar
+ 1
string = input() u = False for letter in range(0,len(string)): unique = string[letter] if unique in string[letter+1::]: u = True break if u: print("Deja Vu") else: print("Unique") refer this code bro.
14th Aug 2020, 1:00 PM
BeastyDSK
BeastyDSK - avatar
0
Saran great! But why to make it lengthy? 🙃🤔
12th Aug 2020, 6:41 PM
Namit Jain
Namit Jain - avatar
0
I'm in my noobie stages as well and I did it a little different the most. Idk if that's a good thing or not. So if someone has input, I'll gladly receive it. rndm_char = input() x = set(rndm_char) re_strng = ''.join(x) print('Unique' if len(rndm_char) == len(re_strng) else 'Deja Vu')
13th Dec 2021, 8:11 PM
Stephen Norton
Stephen Norton - avatar