Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
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🤔🤔
2 Antworten
+ 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
0
https://code.sololearn.com/c6yHapQXfQB7/?ref=app
Hope this helps you