0
Help! Deja Vu Challenge using Python 3. Edit the code below please!
user_input = input(": ") if user_input==str: c=[] for i in len((user_input) -1): user_input[i]+=c for y in len((c)-1): if c[y]==y+1: print("Deja Vu") else: print("Unique")
8 odpowiedzi
+ 3
For python:
myList = list(input())
if any ([myList.count(i) > 1 for i in myList]):
print("Deja Vu")
elif all ([myList.count(i) == 1 for i in myList]):
print("Unique")
+ 2
scrap it all and start again...
Think about sets...what happens when you put a string in a set?
+ 1
Alexandr, What is PEP 8? and why doesn't it return anything? Why only ": "? How is it going to take input the code?
+ 1
rodwynnejones, is there any way except sets? Because i haven't reached that level! I am on try and exceptions
+ 1
myList = list(input())
count = 0
for x in myList:
n = myList.count(x)
if n > 1:
print("Deja Vu")
count = 0
exit()
else:
count += 1
if count > 0:
print("Unique")
0
Loop through the string and use the string count() method.
0
print((lambda i:'Unique' if sorted(i)==sorted(set(i)) else 'Deja Vu')(input()))
0
# Take input as a string and store it in a list
type = list(input())
# Initialize an empty set variable e to store unique characters
e = {""}
# Iterate over each character in the input
for i in type:
# Add the character to the set e
e.add(i)
# Check if the length of the set e minus 1 is equal to the length of the input
# If it is, all characters are unique, so print "Unique"
# Otherwise, there are duplicate characters, so print "Deja Vu"
print('Unique') if len(e)-1 == len(type) else print("Deja Vu")