Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def AddDictionary(s):
- i = 0
- result = {}
- for c in s:
- result[c] = i
- if result.has_key(c):
- i += 1
- return result
- def theMostRepeated(s):
- if len(s) == 0:
- return "The list is empty"
- else:
- keys = AddDictionary(s).keys()
- mx = keys[0]
- for key in keys:
- if AddDictionary(s)[key] > AddDictionary(s)[mx]: #Al comparar las keys no se comparan los numeros sino los valores a los que se refieren
- mx = key
- return mx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement