Here’s my solution to the exercise “This is a common interview question”.
I liked the power of comprehension in Python:
sentence = "This is a common interview question"
# Convert sentence to a set, convert to a list of tupples then sort
sorted_letters = [(letter, sentence.count(letter))
for letter in {unique_letters for unique_letters in sentence}]
sorted_letters.sort(key=lambda item: item[1], reverse=True)
print(sorted_letters[0])