# Regarding exercise of data structure

**URL:** <https://forum.codewithmosh.com/t/regarding-exercise-of-data-structure/19921>\
**Category:** Python\
**Created:** [April 28, 2023, 10:57am UTC](https://forum.codewithmosh.com/t/regarding-exercise-of-data-structure/19921 "2023-04-28T10:57:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@Joseph](https://forum.codewithmosh.com/u/Joseph)\
**Post date:** [April 28, 2023, 10:57am UTC](https://forum.codewithmosh.com/t/regarding-exercise-of-data-structure/19921/1 "2023-04-28T10:57:28Z")

</div>

Hi, here is a question regarding the exercise of data structures chapter of python.  
Here is the code what the course stated:

sentence = “This is a common interview question”  
a = sorted(char\_frequency.items(),  
key=lambda kv:kv[1],  
reverse=True)  
print(a)  
and the output of first is a touple: (‘i’,5).

But why if I divided them into as the following steps, the first output is gonna be (" ", 5), this output exist in the above code as well, just not be the first output.

sentence = “This is a common interview question”  
tupledList= sorted(sentences.items())  
tupledList.sort(key=lambda kv:kv[1], reverse=True)  
print(tupledList)

Thank you.
