Created
April 3, 2019 14:17
-
-
Save romicofre/e4e6a784ff3d621cd56080eea08360bd to your computer and use it in GitHub Desktop.
[Python] Método que retorne las apariciones únicas de cada caracter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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