Skip to content

Instantly share code, notes, and snippets.

@romicofre
Created April 3, 2019 14:17
Show Gist options
  • Save romicofre/e4e6a784ff3d621cd56080eea08360bd to your computer and use it in GitHub Desktop.
Save romicofre/e4e6a784ff3d621cd56080eea08360bd to your computer and use it in GitHub Desktop.
[Python] Método que retorne las apariciones únicas de cada caracter
#Romina Cofre
# Unique appearances of each character
# return: diccionary
# params: String
def appear(S):
rep = {} #diccionary
for c in S:
if c not in rep:
rep[c] = S.count(c)
return rep
#call
S = "abcabb" #string
rep = appear(S)
print (rep)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment