# Solution to the exercise "This is a common interview question"

**URL:** <https://forum.codewithmosh.com/t/solution-to-the-exercise-this-is-a-common-interview-question/11592>\
**Category:** Python\
**Created:** [March 29, 2022, 8:36pm UTC](https://forum.codewithmosh.com/t/solution-to-the-exercise-this-is-a-common-interview-question/11592 "2022-03-29T20:36:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ralf](https://avatars.discourse-cdn.com/v4/letter/r/c89c15/32.png) [@Ralf](https://forum.codewithmosh.com/u/Ralf)\
**Post date:** [March 29, 2022, 8:36pm UTC](https://forum.codewithmosh.com/t/solution-to-the-exercise-this-is-a-common-interview-question/11592/1 "2022-03-29T20:36:47Z")

</div>

Here’s my solution to the exercise “This is a common interview question”.

I liked the power of comprehension in Python:

```auto
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])

```
