for elem in sentence:
.setdefault(elem, 0)
repeat[elem] += 1
print sorted([ (freq,elem) for elem, freq in repeat.items()],reverse=True)[:3]
print repeat
i have this loop which analyses the elements in the loop and then prints by frequency, i wanted to print by frequency and alphabetically.
example
[(5,apple),(5,orange)]