Hello, my program is supposed to print the length of the string inputed, print put characters into a list only if they dont repeat, then print a list of the location of those characters. I am sure there are many ways to do this however, this is the only way i could think of, just setting another variable and adding that variable to a list, however after adding it i need to find out a way to delete the locations of the characters that are duplicate. Thanks.
Code:
string = raw_input("Enter string->")
length = len(string)
indx = 0
z = 0
print "The length of the string is", length
chars_stored = []
frequencysite = []
while length > indx:
if string[indx] == chars_stored:
indx = indx + 1
elif string[indx] != chars_stored:
chars_stored = chars_stored + [(string[indx])]
frequencysite = frequencysite + [z]
z = z + 1
indx = indx + 1
print chars_stored
print frequencysite
Comment