Hi all,
i have register for complete python mastery course, but i m new to coding so it will be very helpful for me to solve this problem
problem : from complete python mastery course lesson No. 5 chapter exercise 23, there is a code and i want to write it as dictionary comprehension. can u plz solve this.
code start from:
sentence = “This is a common interview question”
char_frequency = {}
for char in char_frequency:
if char_frequency[char] += 1
else:
char_frequency[char] = 1
char_frequency_sorted = sorted(
char_frequency.items(),
key=lambda kv: kv[1],
reverse=True)
print(char_frequency_sorted[0])
code ended
please copy and paste it to see proper
thank you so much