Approach1: Set : set is unordered collections of unique elements. a = 'abcdd' if set(a) == a: print 1 else: print 0 Approach 2: Note : Approach 2 is with help of another data structure. a = 'abcd' def uni(a): d = dict() for i in a: if i in d: return False else: d[i] = 1 return True print(uni(a))
ruby on rails cheat sheet, ruby libraries, ruby on rails concepts, rails tutorials for beginner, ruby on rails