0
Code Train Deja Vu error need help
Whats wrong with line 8 " if count > 1: " ?????? input = input() count = 0 dejavu = 0 for letter in 'abcdefghijklmnopqrstuvwxyz': for letter in input: count += 1 if count > 1: dejavu = 1 count = 0 if dejavu = 1: print('Deja Vu') elif dejavu = 0: print('Unique')
4 Réponses
+ 2
It should be under count+=1 with no indentation
+ 1
Thanks, makes sense now
+ 1
For the record I have used a set :
Sets can't have duplicated values so you add all the caracters to a set{} and if there is any duplicate the lengh of the string wont be the same as the lengh of the set.
In other words :
if you have string = 'abc' then the set is {'a', 'b', 'c'} #same length
if you have string = 'aaa' then the set is {'a'} # different length
Very small code !
cheers ;)
0
indentation