Why Is It Printing Unique Instead Of Deja Vu | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why Is It Printing Unique Instead Of Deja Vu

It Tried Solving The Deja Vu Challenges In Code Coach Source Code: ########################### msg = str(input()) alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] for letter in iter(alphabet): same = msg.count(letter) if same == 2: print("Deja Vu") break elif same == 1: print("Unique") break ########################### How Can I Fix This Bug🤔🤔

28th Jan 2021, 5:28 PM
Nothing
Nothing - avatar
2 Answers
+ 1
You are comparing the letters in the alphabet, not the message. Try this msg = str(input()) for letter in msg: same = msg.count(letter) if same == 2: print("Deja Vu") break else: print("Unique") break
29th Jan 2021, 1:50 AM
Rik Wittkopp
Rik Wittkopp - avatar
28th Jan 2021, 5:31 PM
Atul [Inactive]