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')

5th May 2020, 6:47 AM
kxrxkt
kxrxkt - avatar
4 odpowiedzi
+ 2
It should be under count+=1 with no indentation
5th May 2020, 6:52 AM
Abhay
Abhay - avatar
+ 1
Thanks, makes sense now
5th May 2020, 6:53 AM
kxrxkt
kxrxkt - avatar
+ 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 ;)
16th Jun 2020, 7:58 AM
Pierre
0
indentation
5th May 2020, 6:55 AM
esQmo_
esQmo_ - avatar